android.permission.WRITE_SETTINGS不能在清单中使用 [英] android.permission.WRITE_SETTINGS cant use in manifest

查看:3370
本文介绍了android.permission.WRITE_SETTINGS不能在清单中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不能在android清单中使用android.permission.WRITE_SETTINGS.我试图通过编程方式打开飞行模式,但无法在清单中添加此权限.

Can't use android.permission.WRITE_SETTINGS in android manifest. im trying to turn on airplane mode by programatticaly and I can't add this permission in manifest.

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

推荐答案

Android docs 说:

The Android docs says:

注意:如果应用程序的目标是API级别23或更高级别,则应用程序用户必须通过权限管理屏幕向该应用程序明确授予此权限.该应用通过发送具有动作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 ACTION_MANAGE_WRITE_SETTINGS. The app can check whether it has this authorization by calling Settings.System.canWrite().

因此,您必须通过发送具有操作ACTION_MANAGE_WRITE_SETTINGS的意图来明确地请求用户的批准.

So you have to request the user's approval explicitly by sending an intent with action ACTION_MANAGE_WRITE_SETTINGS.

这篇关于android.permission.WRITE_SETTINGS不能在清单中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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