1

I want to send message to specific Whatsapp contact. I have done following code but it only opens chatbox with specific contact but does not sent message.

//send message
String number="97*******";
        Uri uri = Uri.parse("smsto:" + number);
        Intent sendIntent = new Intent(Intent.ACTION_SENDTO, uri);
        sendIntent.putExtra(Intent.EXTRA_TEXT, "Hi this is demo");
        sendIntent.setPackage("com.whatsapp");
        startActivity(Intent.createChooser(sendIntent, ""));

When I add

sendIntent.setType("text/plain");

it gives alert "No Application to perform this action".

Please tell how to resolve this. Thanks in advance.

Nicolai Weitkemper
  • 403
  • 1
  • 9
  • 18

0 Answers0