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;
}