小编Alt*_*iir的帖子

混淆应该显示许可请求的理由

我对 android M 及更高版本的新权限模型有点好奇,尤其是“shouldShowRequestPermissionRationale()”方法。在文档中

为了帮助查找用户可能需要解释的情况,Android 提供了一个实用方法 shouldShowRequestPermissionRationale()。如果应用程序先前已请求此权限并且用户拒绝了该请求,则此方法返回 true。

注意:如果用户过去拒绝了权限请求并在权限请求系统对话框中选择了不再询问选项,则此方法返回 false。如果设备策略禁止应用拥有该权限,该方法也会返回 false。

好的,用户肯定拒绝了权限。现在在同一页面的代码片段中:

// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(thisActivity,
                Manifest.permission.READ_CONTACTS)
        != PackageManager.PERMISSION_GRANTED) {
    // Should we show an explanation?
    if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
            Manifest.permission.READ_CONTACTS)) {

        // Show an expanation to the user *asynchronously* -- don't block
        // this thread waiting for the user's response! After the user
        // sees the explanation, try again to request the permission.

    } else {

        // No explanation needed, we can request the …
Run Code Online (Sandbox Code Playgroud)

android android-permissions android-6.0-marshmallow

6
推荐指数
1
解决办法
6829
查看次数

是否有任何 Flutter SDK 32 位支持?

从 flutter 网站我遇到了系统要求,它实际上只支持 64 位架构。

有什么方法可以使用 32 位 Windows 和 VS Code,还是应该等待最终即将推出的 32 位支持?

flutter

3
推荐指数
1
解决办法
8340
查看次数