Search code examples
androidaccessibilitykindle-fire

Android AccessibilityService compatible to Kindle Fire?


I try to develop an Android application to handle the notifications from other apps and send them to my laptop to notify the user. I use the AccessibilityService to handle the notifications on devices with Android < 4.3 (API Level 18) and the NotificationListenerService for devices with android >= 4.3.

There are no issues getting the notifications on my only android device (Samsung Galaxy S with Android 2.3.3), but I need to activate the App in the accessibility settings.

Now I tried to debug the app on my Kindle Fire (API Level 17) and my apps Activity works fine, but the app is not listed in the accessibility settings of the device. The Amazon App testing service returns no problem, so I dont know where I should search the problem.

Is it possible to use the AccessibilityService on the Kindle Fire?

Here is my android manifest file:

<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="18"
/>

<application
    android:icon="@drawable/ic_launcher"
    android:allowBackup="true">

    <activity
        android:name="de.test.notificationdistributor.SettingsActivity"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>

    <service
        android:name="de.test.notificationdistributor.NotificationDistributorService">

        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>

    </service>

    <service
        android:name="de.test.notificationdistributor.NotificationDistributionDeprService">

        <intent-filter>
            <action android:name="android.accessibilityservice.AccessibilityService" />
        </intent-filter>

    </service>

</application>


Solution

  • You must add the permission android.permission.BIND_ACCESSIBILITY_SERVICE (added in API 16 - android 4.1)

    <service
     android:name="de.test.notificationdistributor.NotificationDistributorService"
     android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
     <meta-data android:name="android.accessibilityservice" android:resource="@xml/accessibilityservice" />
     <intent-filter>
         <action android:name="android.service.notification.NotificationListenerService" />
     </intent-filter>
    </service>
    

    In the doc http://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html

    Additionally an accessibility service must request the BIND_ACCESSIBILITY_SERVICE permission to ensure that only the system can bind to it. Failure to declare this intent will cause the system to ignore the accessibility service.