简体   繁体   English

java.lang.SecurityException:权限被拒绝:打开提供程序 com.android.providers.media.Media

[英]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?我已经检查了这篇文章但无法解决它。我该如何解决这个问题?

You must check for RunTimePermissions in Marshmallow. 您必须在Marshmallow中检查RunTimePermissions。 check this link . 检查此链接 check it for READ_EXTERNAL_STORAGE permission 检查它是否有READ_EXTERNAL_STORAGE权限

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.

相关问题 java.lang.SecurityException:权限拒绝:阅读com.android.providers.media.MediaProvider - java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider java.lang.SecurityException:权限拒绝:打开提供程序 com.android.providers.calendar.CalendarProvider2 - java.lang.SecurityException: Permission Denial: opening provider com.android.providers.calendar.CalendarProvider2 java.lang.SecurityException:Permission Denial:在Android中读取com.android.providers.media.MediaProvider同时从图库中获取图片 - java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider in Android while taking picture from gallery java.lang.SecurityException:权限拒绝:打开提供者com.google.android.apps.photos.content.GooglePhotosImageProvider - java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.content.GooglePhotosImageProvider java.lang.SecurityException:权限拒绝:打开提供程序com.estrongs.android.pop.app.FileContentProvider - java.lang.SecurityException: Permission Denial: opening provider com.estrongs.android.pop.app.FileContentProvider 权限拒绝:开放提供者 com.android.providers.media.MediaDocumentsProvider - Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider java.lang.SecurityException:Permission Denial:打开提供者 - java.lang.SecurityException: Permission Denial: opening provider java.lang.SecurityException:权限拒绝:打开提供程序com.quickblox.q_municate_core.db.DatabaseProvider - java.lang.SecurityException: Permission Denial: opening provider com.quickblox.q_municate_core.db.DatabaseProvider 权限拒绝:重新启动应用程序时打开提供程序 com.android.providers.media.MediaDocumentsProvider - Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider when RESTARTING the app java.lang.SecurityException:权限拒绝:实现内容提供者时打开提供者 - java.lang.SecurityException: Permission Denial: opening provider when implement content provider
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM