Sharing text with image to instagram using android intent

ammcom picture ammcom · Sep 18, 2015 · Viewed 14.7k times · Source

I know that this question has been asked several times before, I am trying to add caption to image shared to instagram using send intent

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM,uri);
shareIntent.putExtra(Intent.EXTRA_TEXT,"YOUR TEXT TO SHARE IN INSTAGRAM");
shareIntent.setPackage("com.instagram.android");
return shareIntent;

Has someone ever managed to make it work?

Is it not supported or has the support been revoked?

Answer

Paul Lammertsma picture Paul Lammertsma · Mar 9, 2016

There was an official statement from Instagram (mid-2015) announcing that pre-populated captions would no longer be accepted in the iOS and Android apps:

Beginning today, the iOS Hooks and Android Intents will stop accepting captions passed by third party apps. This is a non-breaking change: existing mobile apps that utilize pre-filled captions will continue to be able to use this flow to share media through the Instagram apps, but now Instagram will ignore the caption text. To create a caption for a photo or video shared by a third party app, users will have to enter a caption manually, the same way they already do when sharing content using the Instagram native apps.

Looking at the Instagram documentation for Android, indeed we see that there's no mention of providing the conventional Intent.EXTRA_TEXT string extra in the intent as is customary for other apps. Their sample is limited to only providing a Uri:

// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);

// Broadcast the Intent.
startActivity(Intent.createChooser(share, "Share to"));

I'm sorry to say that it simply isn't possible, and we're at the discretion of Facebook in making this decision.