Home Ask Login Register

Developers Planet

Your answer is one click away!

salih kallai February 2016

How to set a specific text for Whatsup and another text for other apps?

I am using the following code to share a text to all messaging applications from my application

String shareBody = "Here is the share content body";
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
    startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using)));

By referring:Android: Share plain text using intent (to all messaging apps)

How to set a specific text for Whatsup and another text for other applications?


Xoce 웃 Пepeúpa February 2016

Try to share with Action.SEND

do this:

Intent myIntentForWhatsapp = new Intent(Intent.ACTION_SEND);
myIntentForWhatsapp.putExtra(Intent.EXTRA_TEXT, "Hallo, this is a msg");
try {
} catch (android.content.ActivityNotFoundException ex) {
    System.out.println("Whatsapp not installed.");

miqdadamirali February 2016

If you want to specify the Intent to only open the WhatsApp application then you do the following

PackageManager manager = context.getPackageManager();
try {
    Intent i = manager.getLaunchIntentForPackage("com.whatsapp");
    if (i == null) {
} catch (PackageManager.NameNotFoundException e) {

Post Status

Asked in February 2016
Viewed 2,320 times
Voted 13
Answered 2 times


Leave an answer

Quote of the day: live life