Instagram Android Share Intent: Unable to load image

2020-03-20 android ionic-framework

I'm facing an issue sending a share intent to Instagram on Android, from the last update from 3 days ago. This is on an Ionic app

I can reproduce the error in the following conditions:

  • Android >= 8
  • Last Instagram Version (133.0.0.32.120)
  • Only sharing to Feed, Stories read the image as expected

I will not add the code I'm using to share because seems to be another thing, some change that Instagram introduced in the last update, maybe permissions or something else.

I discard the image path (read/write) because for Stories it's working fine.

Any ideas? Thanks.

EDIT

I'm still try to find a solution. Meanwhile, if you are having the same issue, please leave a comment on this Facebook Bug ticket

https://developers.facebook.com/support/bugs/1326888287510350/

EDIT 2

This is a workaround solution, I think this is an Instagram bug and should be working again soon, but meanwhile, you can share to Instagram Feed using the MediaStore. I tested this solution on Android 6 to 10.

// Save image to gallery
String savedImageURL = MediaStore.Images.Media.insertImage(
        getContentResolver(),
        mediaPath,
        "My image",
        "My super image description"
);

// Parse the gallery image url to uri
Uri savedImageURI = Uri.parse(savedImageURL);

ClipData clipData = ClipData.newRawUri("Image", savedImageURI);

shareIntent.setClipData(clipData);

To make it work correctly, you will need to ask WRITE_EXTERNAL_STORAGE permission, I handled this part on Ionic side

Answers

Related