3

According to this answer: Can't get clipboard information on Android 10 there is no way to get the clipboard data, on Android 10 and above, unless your app is the default input method editor (IME) or is the app that currently has focus.

However I stumbled upon this workaround:

  1. https://forum.joaoapps.com/index.php?threads/clipboard-monitor-listener-no-longer-works-on-android-10.49808/

  2. https://joaoapps.com/AutoApps/Help/Info/com.joaomgcd.join/android_10_read_logs.html

but I don't understand how and why that works. More importantly, why do we need to use adb to grant these permissions. Can't we add them directly in the Android Manifest file?

zaxunobi
  • 51
  • 9
  • "why do we need to use adb to grant these permissions" -- because they cannot be granted by users to arbitrary apps. Those permissions are for system apps. The `adb` workaround is for developers. – CommonsWare May 20 '21 at 10:35
  • @CommonsWare I mean why can't the dev add these permissions directly in the Android Manifest file and ask instead the users to do this via adb? – zaxunobi May 20 '21 at 10:41
  • 1
    As I wrote, those permissions are for system apps, not ordinary apps written by ordinary developers. – CommonsWare May 20 '21 at 11:58
  • I see. So in theory if I move the app I am developing as system app that should let me read clipdata even for Android 10? Anyway, I've tried those adb commands on my app but I am getting " ...has not requested permission android.permission.READ_LOGS" maybe I should add these permissions in the Manifest file before granting these permissions via adb. – zaxunobi May 20 '21 at 13:56
  • "So in theory if I move the app I am developing as system app that should let me read clipdata even for Android 10?" -- ordinary users cannot do that, though it should be possible on rooted devices. "maybe I should add these permissions in the Manifest file before granting these permissions via adb" -- yes, both steps would be required. – CommonsWare May 20 '21 at 14:26
  • I see. Do you have any idea how to implement the code though? Basically I need to observe the logcat to see if there is any clipboard event, then either briefly show the MainActivity or implement a dummy custom keyboard in order to get the clipdata, but I have no idea how to do all of this. For instance, I am observing the logcat but I don't see any clipboard event denying access for Android 10. – zaxunobi May 21 '21 at 08:03

0 Answers0