Luis Naranjo
Luis Naranjo

Reputation: 669

How can you tell if a user has TalkBack turned on?

I want to know if a user of the app currently has the narrator/TalkBack accessibility feature turned on.

Is there an Android API service I could leverage to check this? I want to alter my UI/UX to be more accessible for those who are using this Android feature.

Upvotes: 2

Views: 1111

Answers (1)

MobA11y
MobA11y

Reputation: 18900

This is actually really straight forward, once we have access to an AccessibilityManager object.

AccessibilityManager accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);

Iterable<AccessibilityServiceInfo> serviceInfoList = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN);

for (AccessibilityServiceInfo serviceInfo : serviceInfoList) {
    //Could get even more specific here if you wanted. IDs have fully qualified package names in them as well.
    if (serviceInfo.getId().endsWith("TalkBackService")) {
        //TalkBack is on do your thing
    }
}

That being said, I implore you to find other design related solutions outside of responding to TalkBacks presence. There are likely better ways to accomplish the same things.

Upvotes: 0

Related Questions