Question

I am obtaining a URI of an image from an SQLite database in my application and then trying to add the image from that URI to a gridview using my adapter.

I am getting an exception asking for MANAGE_DOCUMENTS permission however, I added it in the android manifest yet still getting the exception.

The exception pops up when trying to open the InputStream

InputStream in = cr.openInputStream(Uri.parse(r.getPostImageURL()));

This is the snippet from my manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.androidtutorial1" android:versionCode="1" android:versionName="1.0" >

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" />

<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

The full error:

java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaDocumentsProvider uri   content://com.android.providers.media.documents/document/image%3A46937 from pid=1399, uid=10350 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
Was it helpful?

Solution

look into the following..

Getting Permission Denial Exception

Android KitKat securityException when trying to read from MediaStore

they also have same prob..hope it will helps you.

OTHER TIPS

Have you checked the required api for the kind of request I suggest you use minSdk as 9 or 8 and maxSdk as 19.Hope this works

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top