5
我试图让4.0以上的无障碍服务设置却是露出了异常即如何在android中设置权限WRITE_SECURE_SETTINGS?
造成的:java.lang.SecurityException异常:权限拒绝:写保护设置需要android.permission.WRITE_SECURE_SETTINGS
在清单中,我已经声明了像这样的权限。
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
但是,在清单给出编译错误,即权限只是系统应用程序。 所以我不明白如何解决这个问题。
预先感谢
这里是我的示例代码
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);
}
}