I am developing an android app for the blind community.In my application, I am handling all taps/touches with TTS/audio file.It works fine, but when user turns on TalkBack functionality all taps/touches are dictated twice. First, it will dictate by TalkBack and then my internal mechanism.
I am able to detect TalkBack is enabled or not.
public boolean accessibilityEnable(Context context) {
boolean enable = false;
Log.e("Reached before function", "yes");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
try {
AccessibilityManager manager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
List<AccessibilityServiceInfo> serviceList = manager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN);
Log.e("Reached before for loop", "yes");
for (AccessibilityServiceInfo serviceInfo : serviceList) {
String name = serviceInfo.getSettingsActivityName();
if (!TextUtils.isEmpty(name) && name.equals(TALKBACK_SETTING_ACTIVITY_NAME)) {
enable = true;
Log.e("Reached after if loop", "yes");
}
}
Log.e("Reached after for loop", "yes");
} catch (Exception e) {
Log.e("Error", "Error aaya re");
}
}
return enable;
}
I want to disable talkback functionality whenever my app is active?