android.permission.WRITE_SETTINGS 是否仅授予系统应用程序? [英] Is android.permission.WRITE_SETTINGS only granted to system apps?

查看:65
本文介绍了android.permission.WRITE_SETTINGS 是否仅授予系统应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在开发一款应用,当然,我们希望在用户许可的情况下更改一些系统设置.android 文档说要做到这一点,你必须添加以下权限:

We are currently developing an app where we'd like to change some system settings, with user permission of course. The android documentation says that to do this, you have to add the following permission:

<uses-permission android:name="android.permission.WRITE_SETTINGS" />

此外,必须明确要求用户启用此权限.摘自 https://developer.android.com/reference/android/Manifest.权限#WRITE_SETTINGS 说:

Also, one has to explicitly ask the user to enable this permission. An excerpt from https://developer.android.com/reference/android/Manifest.permission#WRITE_SETTINGS says:

注意:如果应用面向 API 级别 23 或更高级别,应用用户必须通过权限显式授予应用程序此权限管理画面.该应用程序通过发送一个请求用户的批准意图与操作 Settings.ACTION_MANAGE_WRITE_SETTINGS.该应用程序可以通过调用检查它是否具有此授权Settings.System.canWrite().

Note: If the app targets API level 23 or higher, the app user must explicitly grant this permission to the app through a permission management screen. The app requests the user's approval by sending an intent with action Settings.ACTION_MANAGE_WRITE_SETTINGS. The app can check whether it has this authorization by calling Settings.System.canWrite().

到此为止,已经很清楚了.但是,将权限添加到 AndroidManifest.xml 文件后,Android Studio 会抱怨权限仅授予系统应用".现在,这令人困惑,因为我还没有找到任何说明它确实只授予系统应用程序的文档.

所以,我想问一下是否有人遇到过这个问题,是否有某种文档详细解释了这一点?还是我只是遗漏了什么?

Up until this point, it is quite clear. However, when the permission is added to the AndroidManifest.xml file, Android Studio complains that "Permission is only granted to system apps". Now, this is confusing since I haven't found any documentation stating that it is indeed only granted to system apps.

So, I'd like to ask if someone has encountered this issue, and if there is some kind of documentation that explains this in detail? Or am I simply missing something?

推荐答案

正如用户 passsy 在 stackoverflow <问题/brian">Brian,android.permission.WRITE_SETTINGS 有一个 android:protectionLevelsignature",这使得自 API 级别 23 起,权限不可用于用户应用程序.

请参阅 https://developer.android.com/guide/topics/manifest/permission-element#plevel 用于权限保护级别的描述.

As stated by user passsy in the stackoverflow question provided by Brian, android.permission.WRITE_SETTINGS has a android:protectionLevel of "signature", which makes the permission unavailable for use in user applications since API level 23.

See https://developer.android.com/guide/topics/manifest/permission-element#plevel for the description of protection levels for permissions.

这篇关于android.permission.WRITE_SETTINGS 是否仅授予系统应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆