7

I am not able to share any photo on Instagram feed using Intent in Android. It opens Instagram and shows "Unable to load Photo" error and comes back to my app.

 Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, uri);
    share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    startActivity(Intent.createChooser(share, "Share to"));

This same code was working on Instagram version 131.0.0.23.116 but it's not working on the current updated version is 134.0.0.26.121

Amit Kumar
  • 438
  • 1
  • 4
  • 15
  • I had same issue. I think this is about Android 10 updates. For example i have two device first one is android 10, so i can not share a photo into instagram feed but i can share into story. Second one is android 9, works well no problem. – jancooth Mar 24 '20 at 11:21
  • 1
    @jancooth The problem is only with Instagram version as I have checked the issue with both Android 9 (Mi A1) & Android 10. Problem is only in case of Photos but video sharing on Insta feed working fine. – Amit Kumar Mar 25 '20 at 11:45

2 Answers2

2

I got the same problem. It's cannot be sharing with Instagram Feed, but still working when sharing with Instagram Story and Direct. -> That probably an issue of Instagram new update version, not Android os. I try from android version >= 24(N) and got the same error

But when share from Google Photo app to Instagram Feed, still working normally

thangit14
  • 21
  • 4
  • Hi, I working on this bug from a week ago, can't find a solution yet :/ I can reproduce with Android >= 8, lower version are working fine. I'm not an Android developer, I cannot debug the error on IG side, it just like IG don't like any picture shared to FEED, but Stories. So this shouldn't be a problem with permissions, media URI's, image format, etc.. becase for stories are working fine :/ – mauriblint Mar 25 '20 at 09:35
  • 1
    Yes, I have checked the same issue with Google Photos, it's working fine. I am not able to share the photos but video sharing from my app to Insta feeds working fine. – Amit Kumar Mar 25 '20 at 11:44
  • 1
    We have to wait for the facebook development team https://developers.facebook.com/support/bugs/1326888287510350/ – thangit14 Mar 26 '20 at 08:36
  • Google Photos uses the MediaStore content Uri, not a `ContentProvider` or `FileProvider`. Here's a Gist showing how you can write an image or video to the MedisStore, then share that content Uri, which will work when sharing to IG feed until this issue is resolved by the IG dev team: https://gist.github.com/noln/584afabed1362fabbc2516275a5f755b – MattMatt Mar 30 '20 at 16:02
1

It seems that the Instagram app's ability to receive app-internal files via ContentProvider (or FileProvider, a descendent of CP) was broken by a recent update. A workaround is to write the file to MediaStore first then share the content Uri that points to that image file.

Drawback is that the image will be written the the Pictures folder in the MediaStore, but in the meantime it gets sharing to feed working again.

Answer is here, linked to avoid duplication: https://stackoverflow.com/a/60869229/513626

MattMatt
  • 2,242
  • 33
  • 30