I'm using this code to share a collection of images:
final ArrayList<Uri> imageUris = new ArrayList<>();
for (final ImageBean selectedImage : ImageBean.getSelectedImageBeans(imagesBeans)) {
final File imageFile = new File(selectedImage.getPathToImage().getPath());
final Uri contentProviderUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", imageFile);
imageUris.add(contentProviderUri);
}
final Intent shareIntent = new Intent();
shareIntent.setType("image/*");
if (imageUris.size() == 1) {
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUris.get(0));
} else {
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
}
context.startActivity(Intent.createChooser(shareIntent, context.getResources().getText(R.string.share_images_intent)));
I'm mainly interested in uploading to Google Photos. This works great for an image of 600KB, but fails for a 5 MB image (24MP from my camera). So apparently there's a size limit, but as the error happens in the Google Photos activity, I'm unable to debug it (or I don't know Android Studio well enough on how to do that).
Is there a way I can change my Intent so I can upload multiple 24MP images, or is the size limit a given and I need to work around it (eg. by implementing the Google Photos API)?