4

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()
mangusbrother
  • 3,988
  • 11
  • 51
  • 103

2 Answers2

3

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.

Community
  • 1
  • 1
Born To Win
  • 3,319
  • 3
  • 19
  • 27
  • 1
    I fixed how i was adding the URI's to database to be just like http://stackoverflow.com/questions/22178041/getting-permission-denial-exception THANKS – mangusbrother May 09 '14 at 11:14
0

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