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;
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With