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.
- My_APP > showing accessibility as “OFF”
- When I clicked and moved to “enable” the service, it was showing “Enabled” flag as ON(means, it was enabled as shown in images)
showing “Enabled” when goto enable
[showing “Off” in app name]
(https://i.sstatic.net/8Q0O17TK.png)
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 = 26targetSdk = 34
and AGP version = 8.3.2
I have tried this on google chrome cast with android 12.
Yogendra Bhagat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.