husaindevelop

husaindevelop

Clipboard readtext not working in android webview

Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext function. It works just fine in mobile chrome, but in android webview, which is again based on chromium engine, it just does not work.

We have given all permission in android manifest

<uses-permission android:name="android.permission.READ_CLIPBOARD" />
<uses-permission android:name="android.permission.WRITE_CLIPBOARD" />
<uses-permission android:name="android.webkit.PermissionRequest" />
 ClipData clipData = clipboard.getPrimaryClip();
                    ClipData.Item item1 = clipData.getItemAt(0);
                    String text = item1.getText().toString();

webView.evaluateJavascript("(function(){document.activeElement.value = '"+text+"'})()",
                            new ValueCallback<String>() {
                                @Override
                                public void onReceiveValue(String value) {

                                }
                            });

But we are unable to get the paste menu on long press inside textarea just like whatsapp. Guide us as where we are going wrong.

Where Next?

Popular Android topics Top

CristianM92
Hi, I’m working on an app who make the conversion between decimal degrees and degrees minutes seconds. I have to make an “Export” button ...
New
tauseeqafzal
Question: Android Developer → is there any way to read the .trash directory? → we can copy or save the file before delete ? #android...
New
Nevio
Hi, I made an android app and created a signature with keytool. I then bundled the signature in the apk. So, I was wondering if, wanting...
New
Joakins
Android studio displayed access is denied during gradle build C:\Program Files\Java\jdk1.8.0_251\native\68d5fa5c4cc2d200863cafc0d521ce42...
New
AndroidDog123
I’m a developer working as a contractor for a company. I’m finding it confusing on how I should answer these questions? Has Google just b...
New
tunelabguy
I have an expensive app ($160) in the Play Store that I would like to update. I would like to do a beta test of the update with potentia...
New
JesperBlom
Hi Hope it is a simple question :slight_smile: I am planning to use a new PC for making my enterprise app. Everything works perfect, b...
New
sabibo
We recently switched some machines to a network that uses ipV6. Those machines are now unable to package our Unreal game for Android, du...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
Dysentery
I am trying to implement the PIN entry page using device’s TEE. I have acquired the confidential OEM Documentation. It have some C++ code...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New