Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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(Intent.ACTION_SEND); share.setType("image/jpeg"); 

Then with queryIntentActivities() I search to see if Instagram is installed. If it is I send the path of my image to be uploaded:

 share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + path to myfile.png"));  share.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);  share.putExtra(Intent.EXTRA_SUBJECT, "Sample subject");  share.putExtra(Intent.EXTRA_TEXT, "Sample text");  share.putExtra(Intent.EXTRA_TITLE, "Sample title"); 

The result: the image is uploaded using Instagram app (of course if I am logged in), but I can't add a Caption to it. None of the putExtra has any effect. So, is there any way to add a caption as intent parameter ?

And the other question, is it possible to open Instagram app with a certain user name filled in ?

like image 749
Alin Avatar asked Feb 21 '13 12:02

Alin


People also ask

Why can't I add captions to my Instagram post?

To manage captions from your settings: Tap or your profile picture in the bottom right to go to your profile. Tap in the top right, then tap Settings. Tap Account, then tap Captions. Tap or next to Captions to turn them on or off.

Why don't I have the captions feature on Instagram?

If you can't find the captions feature in your sticker menu, it's possible that Instagram Story captions still aren't available in your country. Make sure you're using the newest version of the app.


1 Answers

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.

Intent share = new Intent(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:

  • https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption$20action_send/instagram-api-developers/PJDuG2sTDlM/6bno5dZmoTEJ

  • https://groups.google.com/forum/?fromgroups#!searchin/instagram-api-developers/caption/instagram-api-developers/7XUKm9HSAdg/rJbdSnOmXacJ

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

like image 69
Alejandro Colorado Avatar answered Sep 22 '22 13:09

Alejandro Colorado