I am getting-
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{f1d408f 5594:firebasejobscheduler.test.com.firbasejobschedulerdemo/u0a1227} (pid=5594, uid=11227) requires android.permission.MANAGE_DOCUMENTS or android.permission.MANAGE_DOCUMENTS
at
bm = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri);
I have checked this post but not able to resolve it.How can i resolve this?
You must check for RunTimePermissions in Marshmallow. check this link . check it for READ_EXTERNAL_STORAGE permission
public void chooseImage() {
Intent i = new Intent();
i.setType("image/*");
//i.setAction(Intent.ACTION_GET_CONTENT);
i.setAction(Intent.ACTION_OPEN_DOCUMENT);
//ActivityResultLauncher for opening the gallery
getImageFromGallery.launch(i);
}
That chooseImage() is a function to open the gallery. If you have checked that you have the permission READ_EXTERNAL_STORAGE already requested and accepted by the user, try changing or commenting i.setAction(Intent.ACTION_GET_CONTENT) to i.setAction(Intent.ACTION_OPEN_DOCUMENT).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.