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?