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.

1 3243 0

Where Next?

Popular Android topics Top

Exadra37
I am in the process of research for my next technical blog about bypassing certificate pinning with Frida, thus I need to find some open ...
5 1390 2
New
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 ...
1 835 0
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...
2 670 1
New
Apoorv
I have made my version of browser on android platform.I have used chromium as base. I have build it successfully &amp; but the logo or i...
4 680 2
New
DAZ
Is it possible to develop an application that will generate NFC pulses even when the screen is off?
3 503 2
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...
1 371 1
New
faust
Honest question, do companies still use Java for their new android apps? I thought everybody was using Kotlin these days.
4 344 3
New
Garrett
I’m stuck trying to understand how to get a variable initialised, and later updated, in kotlin to update in Jetpack Compose and cause a c...
1 169 0
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...
0 275 1
New
Devraj5032
I’m using TensorFlow Lite (TFLite) with React Native Expo. When I test the app using the Expo Go app, everything works fine. However, whe...
2 355 0
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1033 17470 383
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
54 3555 17
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...
7 7340 2
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
10 5616 8
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
166 7775 69
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
155 4360 65
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
21 5598 9
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
62 6351 19
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
106 10605 28
New
CommunityNews
Will Swifties’ war on AI fakes spark a deepfake porn reckoning?
0 5956 0
New