Amit Kumar
Amit Kumar

Reputation: 454

Android : Not able to share photos on Instagram using Intent

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

Upvotes: 7

Views: 4937

Answers (2)

MattMatt
MattMatt

Reputation: 2310

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

Upvotes: 1

thangit14
thangit14

Reputation: 21

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

Upvotes: 2

Related Questions