When I switched migrating from react-native with native modules only to kotlin after ‘run application’ (shift+f10) my application removes my accessibility permission. I wonder is there way to always enable it?
Changing the code seems wrong, because it can be published to the end user.
I opened android studio and changed configuration.
I added ‘run external tools’ to Before launch option.
with adb shell settings put secure enabled_accessibility_services myService
but after permission was granted I could not ‘run application’ because of ‘error running app device is already activating’.
I could fix it using adb kill-server.
But for that action I need manually type that command. Is there a way to create a background task that could set this permission.
Using both commands does not help me restart my program and see the new changes, because I get same error.
2
Answers
first problem with error 'running device' connected to adb I fixed on linux this helped me. I used
Second problem solved. I created a simple sh script that listen custom activity event and enable accessibility service even after restart. Only need to run it once in background.
Try this
Here is the code for the same
SERVICE FILE
MANIFEST FILE