0

My project need accessibility feature, I need to enable programmatically. I am using below code snippet to make on.

Settings.Secure.putString(context.getContentResolver(), 
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, 
            appInfo);

        Settings.Secure.putString(context.getContentResolver(), 
                Settings.Secure.ACCESSIBILITY_ENABLED, 
                "1");

        Settings.Secure.putString(context.getContentResolver(),
                                  Settings.Secure.TOUCH_EXPLORATION_ENABLED,
                                  "1");

Settings.Secure.putString(context.getContentResolver(),
                                        "touch_exploration_granted_accessibility_services",
                                  appInfo);

But it is not working does in a android device where 5.1 OS is available. In lower versions it works as expected. any changes in api after 4.0?

Krishna
  • 805
  • 8
  • 14

2 Answers2

0

Only apps that hold the WRITE_SECURE_SETTINGS permission can modify Settings.Secure values. WRITE_SECURE_SETTINGS is a signature-level permission, which ordinary Android SDK apps cannot hold.

You are welcome to create your own custom build of Android, turn that into a custom ROM, and install that ROM on Android devices. Your app, with WRITE_SECURE_SETTINGS, can be a part of that ROM.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Yes i have all permissions , i mean to say our app has route permission . one more it works fine below ICS. But failing in device which has 5.1. – Krishna Feb 28 '16 at 13:39
  • @ashokreddy: "Yes i have all permissions" -- again, you cannot hold `WRITE_SECURE_SETTINGS`, unless your app is signed with the same signing key that signed the device firmware. – CommonsWare Feb 28 '16 at 13:49
  • yes even signed build also not working and as i was telling it works fine upto ICS. – Krishna Feb 28 '16 at 14:10
  • https://github.com/google/talkback/blob/master/src/instrumentation_tests/src/com/googlecode/eyesfree/testing/BaseAccessibilityInstrumentationTestCase.java In above link they were taking some thing about jelly-bean. – Krishna Feb 28 '16 at 14:12
0

The issue is because of the talk back app package name. In some of the devices we need to give the package name of the talk back apk . so this solved my problem

Krishna
  • 805
  • 8
  • 14