我正在尝试启用4.0以上的辅助功能服务设置,但它显示了一个异常,即,
原因: java.lang.SecurityException:权限拒绝:写入安全设置需要android.permission.WRITE_SECURE_SETTINGS
在Manifest中,我像这样声明了这个权限。
<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);
}
}
发布于 2013-10-23 18:18:18
WRITE_SECURE_SETTINGS对应用程序不可用。系统/固件之外的任何应用程序都无法获得该权限。
请检查this答案
https://stackoverflow.com/questions/19538809
复制相似问题