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

big_f
I am making an app with Nativescript-vue and I would like to have an event where I click on an icon and then a new box appears. For the i...
New
Aathithyan
I need to know how to implement outgoing call in my custom application instead of using default phone call app i need my own app call.
New
freerefills
I have an android app whereby notifications will fire and immediately leave the tray. This doesn’t always happen, it’s unpredictable they...
New
vsiPr
I am trying to develop an app which will make your smartphone act as a “keyboard”. I need it to send different symbols to another devices...
New
sonit
Display is not working properly in landscape mode when projection given by pixel 7 version 13 in case of video play by youtube app after ...
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
Rodion
Hello everyone, I recently started learning Kotlin and downloaded Android Studio, but after writing my first code and trying to run it, I...
New
Creator
Could you please help me to find the problem why startScan function is not executed. By debugging after @RequiresBluetoothLocationPermiss...
New
nihar-gingercube
We have developed a audio/video calling functionality using opentok sdk, now we want to integrate speech recognizer for transcribing voic...
New
Sadik
I’ve been hearing a lot about AI in mobile phones lately, and I’m kind of confused about how it’s different from the usual smart features...
New

Other popular topics Top

PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New