How to grant permission Manifest.permission.MANAGE_DOCUMENTS android 6.0

你说的曾经没有我的故事 提交于 2019-11-28 09:30:52

问题


I want to grant the permission Manifest.permission.MANAGE_DOCUMENTS, but when I run the app, the dialog of the permission should appear but it doesn't. Here's my code:

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:


MANAGE_DOCUMENTS is a signature-level permission. Ordinary Android apps cannot hold it. Only apps that were signed by the same signing key that signed the firmware can hold it.



来源:https://stackoverflow.com/questions/35776608/how-to-grant-permission-manifest-permission-manage-documents-android-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!