I am using android native sharing with this code:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "I like to share with you some stuff.");
intent.putExtra(Intent.EXTRA_SUBJECT, "I like to share with you.");
intent.setType(CONTENT_TYPE_TEXT);
startActivity(Intent.createChooser(intent, "Share");
When I use E-Mail as the sharing channel, I get what i want:
Subject: I like to share with you.
Text: I like to share with you some stuff.
When I use WhatsApp as the sharing channel, I get the following text:
I like to share with you.
I like to share with you some stuff.
What do I expect when sharing with Whatsapp:
I like to share with you some stuff.
Is there any option/flag indicating a sharing channel to suppress the subject, if the sharing channel does not support a subject basically.
E.g. E-Mail supports subjects -> Use the provided intent extra. WhatsApp does not support subjects -> Do not use the provided intent extra.
Using queryIntentActivities()
method of PackageManager
class, you can set the intent extras based on package name.
For more info, check this link: How to filter specific apps for ACTION_SEND intent (and set a different text for each app)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With