Submit text tag for Instagram using my Android app

My application removes and sends to instagram, facebook and twitter, but I need to share the text "#myappname" with the image in instagram.

Here is the code I use to send 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 using the codes below to send the 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 anyone know if there is a way to do this?

Thank you and welcome.

+6
source share
3 answers

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

Here is the intent code for sharing 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

+7
source

This is not possible, since for now instagramm, unfortunately, only allows Intent.EXTRA_STREAM. You can check the same question here. Open the Instagram application from another Android application and send the image with the inscription.

+3
source

If you want to interact with the API directly, you need to do a lot of things that I am not familiar with. However, if you want to provide access to any application on a device that accepts images and text, you can simply run startActivity(); when passing the corresponding Intent .

If you have time, I suggest you read the following blog post for Android developers: Share With Intents

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

Hope this is what you are trying to achieve.

+1
source

Source: https://habr.com/ru/post/955530/


All Articles