要求运行时权限时,选中“不再询问"框是否会禁用以后的对话框? [英] Does checking the Never ask again box when asking for a runtime permission disable future dialogs?

查看:183
本文介绍了要求运行时权限时,选中“不再询问"框是否会禁用以后的对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户拒绝了运行时权限,并且选中了不再询问",则是否将来会禁止再次请求相同的权限?用户是否必须进行设置才能启用该权限?

If a user denies a runtime permission with Never ask again checked, does this disable any future ability to ask for the same permission? Does the user have to go through settings to enable that permission?

在我的应用程序中,当我致电

In my application, when I call

ActivityCompat.requestPermissions(this, 
            new String[]{Manifest.permission.READ_PHONE_STATE}, 
            0)

并且该权限先前已被拒绝,并且没有选中"再询问一次",因此根本不会显示对话框.这是预期的行为吗?

and that permission has previously been denied with Never ask again checked, it won't show a dialog box at all. Is this the expected behavior?

推荐答案

这是预期的行为.

来自文档:

当系统要求用户授予权限时,用户可以选择告诉系统不要再次请求该权限.在这种情况下,只要应用再次使用requestPermissions()再次请求该权限,系统就会立即拒绝该请求.系统调用您的onRequestPermissionsResult()回调方法并传递PERMISSION_DENIED,就像用户再次明确拒绝您的请求一样.这意味着,当您调用requestPermissions()时,不能假定已与用户进行了任何直接交互.

When the system asks the user to grant a permission, the user has the option of telling the system not to ask for that permission again. In that case, any time an app uses requestPermissions() to ask for that permission again, the system immediately denies the request. The system calls your onRequestPermissionsResult() callback method and passes PERMISSION_DENIED, the same way it would if the user had explicitly rejected your request again. This means that when you call requestPermissions(), you cannot assume that any direct interaction with the user has taken place.

这篇关于要求运行时权限时,选中“不再询问"框是否会禁用以后的对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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