如何授予权限Manifest.permission.MANAGE_DOCUMENTS android 6.0

时间:2016-03-03 15:43:16

标签: android android-permissions

我想授予权限Manifest.permission.MANAGE_DOCUMENTS,但是当我运行应用时,应该会出现权限对话框但不会出现。这是我的代码:

int hasCameraPermission = ContextCompat.checkSelfPermission(MemoryDetail.this, Manifest.permission.MANAGE_DOCUMENTS);
if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) {
    if (!ActivityCompat.shouldShowRequestPermissionRationale(MemoryDetail.this, Manifest.permission.MANAGE_DOCUMENTS)) {
        showDialogMessage("Need use permission: MANAGE_DOCUMENTS", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                    requestPermissions(new String[] {Manifest.permission.MANAGE_DOCUMENTS}, Database.PICK_PICTURE);
                }
            }
        });

    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        requestPermissions(new String[]{Manifest.permission.MANAGE_DOCUMENTS}, Database.PICK_PICTURE);
    }
    return;
}

1 个答案:

答案 0 :(得分:6)

MANAGE_DOCUMENTSsignature级权限。普通的Android应用程序无法容纳它。只有通过签署固件的相同签名密钥签名的应用才能保留它。