1

My Android app ultimately has a selection of images stored locally, and then shares those using

final Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
shareIntent.setType("image/*");
context.startActivity(Intent.createChooser(shareIntent, "Share images to.."));

One option is to "Upload to Photos", which works perfectly.

However, when then viewing the image in Google Photos, editing the photo (eg. cropping) won't let me save the image, but on "Save a copy". Interestingly, the "Save a copy" action will create a copy in the folder to image originated from, and that copy is not visible in Google Photos. There, only the unedited image remains.

When using my PC instead of my phone, I can edit and save the photo without problems. Also, if I eventually delete the original image on my phone, I can then edit and save the image on Google Photos.

It appears that "Upload to Photos" has a sharing mechanism which keeps to image in Google Photos tied to the original, local source. Can anyone shed some light on the internals here and how to decouple the two images so I can edit and save the image on Google Photos?

Edit

Switching to Android 7.0+ compatible content URIs took a while, see Is there a way to get around size limit for "Upload to Photos". Having gotten that to work, I'm back at the original issue.

Simon
  • 2,994
  • 3
  • 28
  • 37
  • How are you creating the `Uri` values that go into your `EXTRA_STREAM` extra? – CommonsWare Dec 30 '18 at 12:57
  • I get the Uris from querying the Mediastore using EXTERNAL_CONTENT_URI, and then via File. So they are file:// Uris, afaik – Simon Dec 30 '18 at 14:06
  • Those won't work on Android 7.0+, as they will trigger a `FileUriExposedException`. So, IMHO, you have bigger problems than the Google Photos behavior. In general, it is up to the developers of the app consuming the content (e.g., Google Photos) for how they want to handle that content. The "internals here" would be the internals of Google Photos, and AFAIK that is not an open source app. – CommonsWare Dec 30 '18 at 14:20
  • Good point, thanks @CommonsWare for the hint. I just switched my code to use FileProvider.getUriForFile() to generate a content:// Uri, I'll see if that also resolved the Google Photos editing issue. – Simon Dec 30 '18 at 19:14

0 Answers0