This question already has an answer here:
- Send text to specific contact programmatically (whatsapp) 19 answers
I want to send a message using whatsapp only to a particular contact without the user having to select it from his contact list. I am using the below code to fire an intent
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setPackage("com.whatsapp");
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
But this opens the whatsapp contact screen from which the user has to select the contact name.