Skip to content Skip to sidebar Skip to footer

Instagram From Android Open On Certain User And Add Caption To Uploaded Image

Instagram for Android is very limited, from what I have seen so far. My scenario is simple: allow the user to edit a picture and when he clicks on Send: Intent share = new Intent(I

Solution 1:

It looks as if Instagram's Android App ignores EXTRA_TEXT, EXTRA_SUBJECT and EXTRA_TITLE, so it seems that adding a caption while uploading an image is not possible. By the way, you can try different approaches to check if it ignores those extras in every case:

OPTION #1: Changing the MIME type.

You are setting the MIME type to "image/jpeg". Try using "image/" or "/*" to check if their app doesn't ignore those extras.

share.setType("image/*");

or

share.setType("*/*");

OPTION #2:

As you are sending multiple MIME types (image and text), maybe their app is expecting ACTION_SEND_MULTIPLE instead of ACTION_SEND.

Intentshare=newIntent(Intent.ACTION_SEND_MULTIPLE);

OPTION #3: Use MediaStore.Images.Media.insertImage(ContentResolver cr, String imagePath, String name, String description) function:

Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getContentResolver(), "file:///" + path to myfile.png", "Sample title", "Sample description")));
share.setType("image/jpeg");
share.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);

OPTION #4: Post your issue in their developer forum, although there are similar questions that remain unsolved:

And don't forget to come back and tell us their answer!

Solution 2:

It looks like Instagram has updated their app to accept EXTRA_TEXT to add a caption. If the user has an updated version of Instagram (July 1, 2014 version or later) you can post an image and add a caption with the following code:

Intentinstagram=newIntent(android.content.Intent.ACTION_SEND);
instagram.setType("image/*");
instagram.putExtra(Intent.EXTRA_STREAM, [URI of photo]);
instagram.putExtra(Intent.EXTRA_TEXT, [Text of caption]);
instagram.setPackage(instagramPackageName);
startActivity(instagram);

Users with older versions will still get the image, but not have the caption be pre populated.

This code is assuming you have already been through the auth flow.

Post a Comment for "Instagram From Android Open On Certain User And Add Caption To Uploaded Image"