How can I programmatically enable/disable an android screen reader service such as TalkBack?
I am developing a kiosk type application that will be installed on an Androi
I think there might be a way to do that if you make your app an AccessibilityService (but you would have to enable it manually after install).
Then in your AccessibilityService class, inside onAccessibilityEventmethod you can explore views (recursively) and perform clicks - in the example below it will click on TalkBack item in settings - after that it should toggle the toggle button on next screen (the trick is that you can click on parent not the switch view itself) - I haven't tried this code :)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
AccessibilityNodeInfo source = event.getSource();
if(event.getEventType()==AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
explore(source);
}
private void explore(AccessibilityNodeInfo view){
int count = view.getChildCount();
for(int i=0; i
so now if you open accessibility settings with Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); it will perform clicks for you - you would have to somehow cover it with full screen toast or service with view
I'm currently working on automatic airplane mode toggle and it works - so should do the job in your case
take a look on my serviceconfig.xml