6

My app takes pictures and sends it to Instagram, Facebook, and twitter but I need to share the text "#myappname" with the picture on Instagram.

Here's the code I use to send the photos

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/*");
caminhoImagens = getRealPathFromURI(Uri.parse(url));
Log.i("Caminho imagem: ", caminhoImagens);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + caminhoImagens));
shareIntent.setPackage("com.instagram.android");
startActivity(shareIntent);

I tried to use the codes below to send a text together but didn't work.

shareIntent.putExtra(Intent.EXTRA_TEXT,"#TEXT");
shareIntent.putExtra(Intent.EXTRA_TITLE,"#TEXT");
shareIntent.putExtra(Intent.EXTRA_SUBJECT,"#TEXT");

Does someone know if there is a way to do that?

Thanks and regards.

groff07
  • 2,363
  • 3
  • 32
  • 48
  • 1
    I just answered a very similar question [here](http://stackoverflow.com/a/19292103/771072). It's my belief that this is not possible for now – linakis Oct 10 '13 at 09:35
  • Thanks @bororo. I searched a lot for a solution but I think you are right. Today we don't have a way to do that and I believe we will not have a way to do that soon. – groff07 Oct 10 '13 at 12:33
  • Now it's possible...take a look at the accepted answer!!! @bororo – groff07 Sep 17 '14 at 18:34

3 Answers3

6

Finally, Instagram API supports text coming from Android apps using Intent.

Here is the intent code to share images and text on Instagram.

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;

Here is the documentation

groff07
  • 2,363
  • 3
  • 32
  • 48
3

It's not possible, since for now instagramm accepts only Intent.EXTRA_STREAM unfortunately. You can check same question here Open Instagram app from another android app and send an Image with a Caption

Community
  • 1
  • 1
Defuera
  • 5,356
  • 3
  • 32
  • 38
1

If you're looking to interact with they're API's directly there is a lot of stuff you need to do that I'm not familiar with. However, if you want to share to any app on the device that accepts an image and text you can just run startActivity(); while passing in a proper Intent.

If you have time, I suggest you read the following Android Developer Blog post: Share With Intents

Or, have a look at the following quesiton on SO: flickr, tumblr , instagram share intent in android

Hopefully that is what you're trying to achieve.

Community
  • 1
  • 1
jeffmcnd
  • 592
  • 4
  • 14
  • Thanks for the links and the answer @jdawes. Today my app send photos to Instagram but I need to send a text together and I didn't found a way to do that. I will update my question. Take a look. – groff07 Oct 09 '13 at 13:26