如何在android中设置权限WRITE_SECURE_SETTINGS?

har*_*h J 11 android android-service

我正在尝试启用4.0以上的辅助功能服务设置,但它显示异常即,

引起:java.lang.SecurityException:权限拒绝:写入安全设置需要android.permission.WRITE_SECURE_SETTINGS

在Manifest中我已经声明了这样的权限.

<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
Run Code Online (Sandbox Code Playgroud)

但是在清单给出编译错误,即权限只是系统应用程序.所以我不知道如何解决这个问题.

提前致谢

这是我的示例代码

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);
            }
        }
Run Code Online (Sandbox Code Playgroud)

nul*_*ter 12

WRITE_SECURE_SETTINGS不适用于应用程序.系统/固件之外的任何应用都无法获得该认可.

请检查这个答案