Android 12, Kotlin: Why is my app is not listed as an installed app under ACESSIBILITY when ACESSIBLITY INTENT is displayed? - S

admin2025-05-01  2

I am writing an app that requires ACCESSIBILITY SERVICE PERMISSION. So, I have the following code that brings up ACCESSIBILITY intent as soon as the app is started. Under ACCESSIBILITY intent -> Installed Apps, I noticed my app is not listed. How come and how do I get my app listed under ACCESSIBILITY installed apps. So, I can enable ACCESSIBILTY PERMISSION for my app.

Here is the permission in AndroidManifest.xml:

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

Here is the code in the MainActivity.kt

    if (!isAccessibilityServiceEnable(applicationContext)) {
        val accessibleIntent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS) 
        startActivity(accessibleIntent)
    }

    private fun isAccessibilityServiceEnable(context: Context): Boolean { 
            val accessibilityManager = (context.getSystemService(ACCESSIBILITY_SERVICE) as AccessibilityManager)
            val accessibilityServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)
        for (info in accessibilityServices) {
            if (info.id.contains(context.packageName)) {
                return true
            }
       }
       return false
    }

Here is the image of the Intent Have a look at the red arrow:

I am writing an app that requires ACCESSIBILITY SERVICE PERMISSION. So, I have the following code that brings up ACCESSIBILITY intent as soon as the app is started. Under ACCESSIBILITY intent -> Installed Apps, I noticed my app is not listed. How come and how do I get my app listed under ACCESSIBILITY installed apps. So, I can enable ACCESSIBILTY PERMISSION for my app.

Here is the permission in AndroidManifest.xml:

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

Here is the code in the MainActivity.kt

    if (!isAccessibilityServiceEnable(applicationContext)) {
        val accessibleIntent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS) 
        startActivity(accessibleIntent)
    }

    private fun isAccessibilityServiceEnable(context: Context): Boolean { 
            val accessibilityManager = (context.getSystemService(ACCESSIBILITY_SERVICE) as AccessibilityManager)
            val accessibilityServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)
        for (info in accessibilityServices) {
            if (info.id.contains(context.packageName)) {
                return true
            }
       }
       return false
    }

Here is the image of the Intent Have a look at the red arrow:

Share Improve this question asked Jan 2 at 17:35 ThNThN 3,2745 gold badges64 silver badges120 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

From what I can tell in the accessibility service documentation, you need that permission in the service, not as a standalone uses-permission:

  <application>
    <service android:name=".MyAccessibilityService"
        android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
        android:label="@string/accessibility_service_label">
      <intent-filter>
        <action android:name="android.accessibilityservice.AccessibilityService" />
      </intent-filter>
    </service>
  </application>
转载请注明原文地址:http://www.anycun.com/QandA/1746104699a91733.html