I'm looking for sending whatsapp message to spesific contact and i try this code but it doesn't work with me the code open the spesific contact but it doesn't send the message
String message="at first";
try {
Uri uri = Uri.parse("smsto:"+"+999999999");
Intent sendIntent = new Intent(Intent.ACTION_SENDTO, uri);
//sendIntent.setAction(Intent.ACTION_SEND);
//sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
//sendIntent.setType("text/plain");
sendIntent.setPackage("com.whatsapp");
if sendIntent!= null) {
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
startActivity(sendIntent);
}else{
Toast.makeText(this, "WhatsApp not Installed", Toast.LENGTH_SHORT).show();
}
message="done";
}catch(Exception ex){
message="Error: "+ex.toString();
}finally{
TextView mas = (TextView) findViewById(R.id.mas);
mas.setText(message);
}