Akash Verma Akash Verma - 1 month ago 7
Android Question

How to share application data to whatsapp friends??

I am developing an android application in which I want to share my data through WhatsApp and hike(to my friends in phone contact) or mail to my friends.

Can someone please explain me with lines of codes...

Answer

Like most social Android apps, WhatsApp listens to intents to share media and text. Simply create an intent to share text, for example :

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

startActivity(sendIntent);