Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to share in whats app from Android application

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 65
    Comment on it

    Using Android Intent system we can share on whats app from our application. Whats App application have listeners that listen to intents to share media and texts.
    Simply create an intent to share text, for example, and WhatsApp will be displayed by the system picker:

    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
    sendIntent.setType("text/plain");
    startActivity(sendIntent);
    

    However, if you want to share directly to WhatsApp and bypass the system picker, you can do so by using setPackage in your intent:

    sendIntent.setPackage("com.whatsapp");
    

    This would simply be set right before you call startActivity(sendIntent);
    Note:- Make sure that you have whats app installed in your device before calling the above Intent

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: