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

GET_CLIPBOARD fails on Android 11 #51

Open
rpes opened this issue Sep 9, 2021 · 6 comments
Open

GET_CLIPBOARD fails on Android 11 #51

rpes opened this issue Sep 9, 2021 · 6 comments

Comments

@rpes
Copy link

rpes commented Sep 9, 2021

My app sets the Android clipboard using SET_CLIPBOARD and then immediately verifies the result through GET_CLIPBOARD.

It works well on my Android 9 device (an old Sony Xperia). It always fails on Google Pixel 4a with the latest Android 11. The SET_CLIPBOARD operation succeeds. I can verify it on the phone. When I send a subsequent GET_CLIPBOARD request the STF service returns an empty text.

In fact I have never succeeded to get any clipboard content from STF on this device. Even if I copy a text on the device screen manually the GET_CLIPBOARD fails to return it.

@DonVietnam
Copy link

I also ran into this problem on Android 11.
I tried to create an application with the current changes #97, the problem still remains.

@DonVietnam
Copy link

@rpes
In fact, at the moment, receiving data from the clipboard should work correctly, as far as Android allows, but Android version 10 and higher prohibits receiving data from the clipboard. Below is the link:

https://developer.android.com/about/versions/10/privacy/changes#clipboard-data

Therefore, on devices with OS version 10+, you must first focus on STFService, and then copy data from the device.

The solution would be to make a separate service and register it as an input method editor (IME).

@koral--
Copy link
Member

koral-- commented Dec 29, 2022

Could you make a PR for that?

@DonVietnam
Copy link

Actualy, I'm not an android developer, so I can hardly help here, I'm developing a solution based on STF and I ran into this problem, in fact I'm just a Node js developer.
But if someone wants to move towards solving this problem, I think it's worth paying attention to appium, they, like, had to face it.

@mofmofmofneko
Copy link

@DonVietnam Thank you for your useful information.
But your suggestion has a problem.
・Creating your own IME would be too costly for this project.
・If you are a developer who develops an IME and you have no choice but to use your own IME, it cannot be verified in this project environment.

As a solution, I propose to bring the active window to the front and hide it while the service is running.
I don't have an android 11 verification environment, so I'll create a sample code, although it's experimental, so please wait a moment.

@mofmofmofneko
Copy link

@DonVietnam Sorry I made you wait.
You can try #100 pull requests.
It takes about a week for me to prepare the appropriate environment for verification, so please wait for a while if you want to try the stable version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants