Reputation: 21
I have created android tv app by using custom accessibility service. I am using it to listen "HOME" button key event to launch my app (when user presses "HOME" button on d-pad). Everything works fine but sometimes I observed, the accessibility service get disabled automatically.
When I checked to Settings > Accessibility > My_APP, I found the below case.
What is the reason behind this? What I am doing wrong here or How I need to handle this, where accessibility should not disabled automatically until user disables it?
Below is my service_config.xml
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeViewClicked"
android:accessibilityFeedbackType="feedbackGeneric|feedbackVisual"
android:canRetrieveWindowContent="true"
android:accessibilityFlags="flagReportViewIds|flagRequestFilterKeyEvents"
android:description="@string/app_name"
android:canPerformGestures="true"
android:canRequestFilterKeyEvents ="true"
android:notificationTimeout="150"/>
My app has sdk support as below: minSdk = 26, targetSdk = 34 and AGP version = 8.3.2
I have tried this on google chrome cast with android 12.
Upvotes: 2
Views: 801
Reputation: 1111
Your accessibility service is being automatically disabled because Android restricts apps from intercepting protected key events like the “HOME” button for security reasons. When your app tries to listen for the “HOME” button press, the system may detect this and disable your service to prevent misuse. To resolve this, avoid intercepting the “HOME” button and redesign your app to function without relying on capturing this key event.
Upvotes: 0
Reputation: 1
It happens on my tv tv security app make this, disable it with adb or give permission in security app too it work on my tcl google tv
Upvotes: 0