[英]java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.Media
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?我已经检查了这篇文章但无法解决它。我该如何解决这个问题?
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.那个 chooseImage() 是一个 function 打开画廊。 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).
如果您已检查您是否已获得用户请求并接受的权限 READ_EXTERNAL_STORAGE,请尝试将 i.setAction(Intent.ACTION_GET_CONTENT) 更改或注释为 i.setAction(Intent.ACTION_OPEN_DOCUMENT)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.