I’m working on a Android App that needs to use the Android Accessibility Service.
I’ve got it all kind of working by:
- Adding permission to my service in manifest.xml
- Extending AccessibilityService and overriding
onAccessibilityEvent
However when I try to check if the user has enabled Accessibilty Setting / Permission, by calling checkSelfPermission
, it always returns “-1” aka, PERMISSION_DENIED
for BIND_ACCESSIBILITY_SERVICE
.
Am i missing something?
Is it possible to check if a setting / permission is enabled or not?
Is AccessibiliyService a special case, and you can’t check permissions as normal?
I can possibly work around by setting a static variable running=true
in my AccessbilityService when it runs for the first time, but this feels a little messy.
Thanks in advance, I’ve been struggling with this for 1/2 the day :(
I’ve tried requesting permissions:
- By following this guide: https://developer.android.com/training/permissions/requesting.html but with no joy.
To clarify:
I was intending on checking the Accessibility Service "permission" to see if the user had enabled it already, and if not, correctly prompt the user that they need to enable via settings.