0

Only issue with Android Nexus 4, OS 4.2

Getting images from Media Gallery using content path give error in only nexus 4.

Content Path like this : content://com.google.android.gallery3d.provider/picasa/item/itemID

Error :

    java.lang.SecurityException: Permission Denial: opening provider
com.android.gallery3d.provider.GalleryProvider from ProcessRecord{658fa748 
4598:com.backlotauctions/u0a739} (pid=4598, uid=10739) requires 
com.google.android.gallery3d.permission.GALLERY_PROVIDER or 
com.google.android.gallery3d.permission.GALLERY_PROVIDER

My Code is:

InputStream is = null;
is = mActivity.getContentResolver().openInputStream(Uri.parse(ImagePath));
OutputStream os = new FileOutputStream(f);
Utils.CopyStream(is, os);
os.close();

This error occurred while content Resolver openInputStream() using image path.

Deval Patel
  • 780
  • 7
  • 18
  • Where did you get this `Uri` from? – CommonsWare Apr 28 '14 at 13:33
  • This uri get from Media Gallery while select image using intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, GALLERY_REQUEST_CODE); – Deval Patel Apr 28 '14 at 13:36
  • Take a look here: http://stackoverflow.com/questions/13558177/security-exception-when-trying-to-access-a-picasa-image-on-device-running-4-2 –  Apr 28 '14 at 13:39
  • it's mentioned there http://stackoverflow.com/questions/18587967/securityexception-when-downloading-images-with-the-universal-image-downloader – xgc1986 Apr 28 '14 at 13:41
  • I already go through this post but not getting solution. – Deval Patel Apr 28 '14 at 13:43

1 Answers1

0

I had the same problem a while ago. see my question here

Security Exception when trying to access a Picasa image on device running 4.2

It seems you cannot hold onto the uri of picasa images and just pull the image from the uri everytime, you can only use the uri once.

basically what I ended up doing was saving the image locally the first time and use that uri for the image

Community
  • 1
  • 1
tyczj
  • 71,600
  • 54
  • 194
  • 296