Programmatically enabling/disabling accessibility settings on Android device

前端 未结 3 955
误落风尘
误落风尘 2021-02-05 21:00

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

3条回答
  •  感情败类
    2021-02-05 21:30

    Only system apps can enable/disable accessibility service programatically. System apps can directly write in settings secure db to start accessibility service.

    Settings.Secure.putString(getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.packagename/com.packagename.componentname");
    

    Following permission is required to write in settings secure db:

    
    

    For non system apps, only way to start accessibility service is direct them to accessibility settings screen via intent and let user manually start the service :

    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    

提交回复
热议问题