0

I am trying to share an image and caption to other apps using intents. I can do so in WhatsApp and Telegram using the following code:

Uri uri = Uri.fromFile(localFile);

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.putExtra(Intent.EXTRA_TEXT, caption);
startActivity(Intent.createChooser(intent, "Share Poster"));

It works completely fine for WhatsApp and telegram, but when I choose Instagram, it opens at first and close by showing a toast saying "not supported format".

By reading documentation I found out that Instagram does not support prepopulated captions.

So I only want to send the image to Instagram and image + text to other apps. How can I do so?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    have a good read at answers [In this Thread](https://stackoverflow.com/questions/32640765/sharing-text-with-image-to-instagram-using-android-intent). – ADM Sep 15 '20 at 11:44
  • 1
    @blackapps and ADM instagram is opening at first and closes saying not supported format and I come back to my app. I want to share contents according to the app that user selects. – Sandeep Shiven Sep 15 '20 at 12:30

0 Answers0