I have written my own accessibility service. It works fine on 4.1.1 and below. However, I found out that I couldn't find the service on 4.2.2 in Settings>Accessibility. Is there something I should know about accessibily on 4.2.2?
this is I declare in Android Manifest
<service android:name="my_service_name"
android:label="@string/accessibility_service_lable">
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config"/>
<intent-filter >
<action android:name="android.accessibilityservice.AccessibilityService"/>
</intent-filter>
</service>
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
the follow is the config file, it is very simple.
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/accessibility_service_description"
/>
Your manifest should declare the bind permission on your service, rather than as a uses-permission element.
This permission is used to prevent non-system applications from binding to your service, which could potentially be a security issue. If your service doesn't require this permission for binding, then the system will ignore it to protect the user.
So, your manifest should look like:
<service android:name="my_service_name"
android:label="@string/accessibility_service_lable"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" >
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config"/>
<intent-filter >
<action android:name="android.accessibilityservice.AccessibilityService"/>
</intent-filter>
</service>