I am trying to enable accessibility service settings above 4.0, but Exception ie is displayed,
Called: java.lang.SecurityException: permission denied: android .permission.WRITE_SECURE_SETTINGS is required to write to secure settings
In the manifest, I declared this permission as follows.
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
But in the manifest giving the compilation an Error, i.e. resolution is only system applications. Therefore, I do not understand how to solve this problem.
thanks in advance
Here is my sample code
if (Settings.Secure.getString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED).contains("1")) { if (Settings.Secure.getString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED).contains("1")) { System.out.println("Putting the Value to Enable.."); Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); } else { Settings.Secure.putInt(getContentResolver(), Settings.Secure.TOUCH_EXPLORATION_ENABLED, 1); } }
source share