8

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?

Community
  • 1
  • 1
Android Developer
  • 7,969
  • 18
  • 66
  • 128

1 Answers1

1

You must check for RunTimePermissions in Marshmallow. check this link . check it for READ_EXTERNAL_STORAGE permission

  • 2
    believe me its not working, securityException comes only when your application is not allowing some permission... your exception asking for **android.permission.MANAGE_DOCUMENTS** permission.. try for this permission too.. – Chinmay Thoriya Feb 07 '17 at 11:52
  • If you want to check your app anyway, then in your android device go to setting-> application->_yourapp_->permissions-> allow all the permissions required, **but its not recommended**, you should provide UI for allowing permission from application.. here you can see what permissions are required – Chinmay Thoriya Feb 07 '17 at 11:59
  • i have added permission in both manifest and at runtime..i already checked that..i am using `bm = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri);` inside service and after i rebbot device if my service starts i get this crash – Android Developer Feb 07 '17 at 15:45
  • are you saving the permission status in sharedPreferences ? It may happen if you dont save permission status. – Chinmay Thoriya Feb 09 '17 at 08:24