Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 10 clipboard not working properly #678

Closed
armadastate opened this issue Feb 11, 2021 · 5 comments
Closed

Android 10 clipboard not working properly #678

armadastate opened this issue Feb 11, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@armadastate
Copy link

Environment

Technology Version
Flutter version 1.22.6
Plugin version 4.0.0+4
Android version 10

Device information: Pixel 2

Description

Try run simple code and check next steps:

  1. Run app, wait for google.com is loaded
  2. Go to other app where you can copy some text to your clipboard
  3. Try paste it to test app in google search
    In this flow you will have nothing(

Check 2:

  1. Open some app and copy some text to clipboard
  2. Run test app, and try paste text from clipboard to goole search - yeah, this working fine
  3. Switch by RecentApps to app with text, copy some other text to clipboard
  4. Switch back to test app, try paste = you will see old text (clipboard is not updating on android 10)

After few hours spend to research module I found a little bit "hacky" way to fix this:
in file
{FLUTTER_SDK}.pub-cache\hosted\pub.dartlang.org\flutter_inappwebview-4.0.0+4\android\src\main\java\com\pichillilorenzo\flutter_inappwebview\InAppWebView\InAppWebView.java

add
onWindowFocusChanged(true);
at rebuildActionMode() function begin:

like this:

  public ActionMode rebuildActionMode(
          final ActionMode actionMode,
          final ActionMode.Callback callback
  ) {
    onWindowFocusChanged(true);
    boolean hasBeenRemovedAndRebuilt = false;

so chrome WebView will be notified for FocusChanged and will update data from clipboard

P.S. this is fast solution and not pretty good for use, but I need working WebView, maybe someone need too |./|

@armadastate armadastate added the bug Something isn't working label Feb 11, 2021
@pichillilorenzo
Copy link
Owner

Thanks, this way it will resolve the problem!
Maybe it could be this:

onWindowFocusChanged(isFocused());

I'm going to add this fix with the next commit.

@armadastate
Copy link
Author

armadastate commented Feb 11, 2021

I'm newbie in flutter, and not fully understand view managment. But I see containerView, and I think this can be a solution:

if (containerView != null)
  onWindowFocusChanged(containerView.isFocused());

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Feb 11, 2021

yeah it seems good! thanks! maybe also:

if (containerView != null)
  onWindowFocusChanged(isFocused());

@callmejm
Copy link

version 5.3.2, I still facing this issue

@DurgeshSawantWYLD
Copy link

Currently using flutter_inappwebview: ^5.7.2+3
it threw the following exception
{message: Uncaught (in promise) NotAllowedError: Write permission denied., messageLevel: 3}

Please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants