Note that there are some explanatory texts on larger screens.

plurals
  1. POShare Intent of Google+ can not access image
    text
    copied!<p>i am calling an intent to share an image. this works with most providers, BUT with Google+. Google+ opens the post activity without the image and displays the toast "You can only post photos stored on your device." at the same time.</p> <pre><code> File f = storeImage(image); // f = /data/data/com.myapp/files/1333070776978.jpg Uri uri = Uri.fromFile(f); Intent share = new Intent(Intent.ACTION_SEND); share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); share.setType("image/jpeg"); share.putExtra(Intent.EXTRA_STREAM, uri); share.putExtra(Intent.EXTRA_TITLE,"Share that title"); share.putExtra(Intent.EXTRA_SUBJECT,"Share that subject"); share.putExtra(Intent.EXTRA_TEXT,"Check that out..."); share.putExtra("sms_body", "sms body"); startActivity(Intent.createChooser(share, "Share Image")); </code></pre> <p>i save the image with</p> <pre><code> Context.openFileOutput(fileName, Context.MODE_WORLD_READABLE); </code></pre> <p>my understanding was that by setting FLAG_GRANT_READ_URI_PERMISSION, i give Google+ specific access to this file.</p> <p>it works when i store the image into the MediaStore, but i actually don't wanna clutter the users image gallery.</p> <pre><code> ContentValues values = new ContentValues(2); values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); values.put(MediaStore.Images.Media.DATA, f.getAbsolutePath()); Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); </code></pre> <p>any advice is appreciated</p> <p>Simon</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload