0

I am trying to send plain text through whatsapp from my application.

When i open whatsapp from my application i am moving to "Select contact" page

How to open "whatsaapp chat page"..?

PackageManager pm=getPackageManager();
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
String text = previewtext.getText().toString();

pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);
waIntent.setPackage("com.whatsapp");
waIntent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(waIntent, "Share with"));

Thank u.

shiv
  • 127
  • 1
  • 3
  • 13
  • 1
    I don't think you can directly send a message without the user doing anything. This would be a security hole. – ByteHamster May 03 '15 at 09:54
  • No, I am talking about page/Window. Now i am selecting contact from contact page -> then again same contact from Chat window -> then the msg. I wan't avoid two steps. I wish to select particular contact from Chat window. Similar to when we open whatsapp application the first window will be chat. – shiv May 03 '15 at 10:06
  • @yushi, why is it so. Can u share the reason – shiv May 03 '15 at 14:11

0 Answers0