“写入设置"权限未授予棉花糖android [英] "Write settings" permission not granted marshmallow android

查看:169
本文介绍了“写入设置"权限未授予棉花糖android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我已经在清单中声明了以上一行,并且我请求活动启动权限,但与其他权限不同,重新启动我的应用程序后,它再次要求获得权限.当我检查是否已授予权限时,我会得到结果那说不只是授予此​​权限,而是当我与其他权限检查相同的内容时,在用户这样做后才授予它们.

I have declared above line in my manifest ,and i ask for permission on activity start but unlike other permissions,after restarting my app,it again asks for permission.When i check if permission has been granted or not,i get result that says not granted for only this permission but when i checked the same thing with other permissions ,they are granted after the user has done so.

ActivityCompat.requestPermissions(SplashScreen.this,PERMISSIONS, 1);

我通过以下方式进行检查: EasyPermissions.hasPermissions(this,PERMISSIONS)

i check with : EasyPermissions.hasPermissions(this,PERMISSIONS)

推荐答案

使用此设置进行写设置权限:

use this for write setting permission:

 public void settingPermission() {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (!Settings.System.canWrite(getApplicationContext())) {
                Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS, Uri.parse("package:" + getPackageName()));
                startActivityForResult(intent, 200);

            }
        }
    }

这篇关于“写入设置"权限未授予棉花糖android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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