user1582733 user1582733 - 2 years ago 126
Android Question

send message in background to whatsapp number using external application

  • Tried everything on stackoverflow, now i am being able to take the msg frwd. But the msg is not sent until you actually click a no. from whatsApp contact list ..... Plz help been stuck here for few days....
    Thing is that i am trying to build an app, in which when I give a number then msg should be sent to it using whatsapp. With this code msg is being frwded and when I select a number it sends the pre-defined msg to it. But I want that the msg should be directly sent without whatsApp waiting for user to click on a number..

    //checks if whats app is installed or not..
    private boolean whatsappInstalledOrNot(String uri) {
    PackageManager pm = getPackageManager();
    boolean app_installed = false;
    try {
    pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
    app_installed = true;
    } catch (PackageManager.NameNotFoundException e) {
    app_installed = false;
    return app_installed;

    //Main Process
    boolean isWhatsappInstalled = whatsappInstalledOrNot("com.whatsapp");
    if (isWhatsappInstalled) {
    String a="91*********0";// the nuber to which msg is to be sent
    Uri uri = Uri.parse("smsto:" + a);
    Intent sendIntent = new Intent(Intent.ACTION_SEND, uri);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "Test message"+a);//msg to be sent
    //sendIntent.putExtra("sms_body", "ydyeryyerf");
    sendIntent.setType("text/plain");// type of msg->text
    sendIntent.setPackage("com.whatsapp");// picks whats app
    // startActivity(sendIntent);
    startActivity(Intent.createChooser(sendIntent, a));//starts whats app
    } else {
    // should redriect to play store to download whatsApp
    Toast.makeText(getApplicationContext(), "WhatsApp not Installed",
    Uri uri = Uri.parse("market://details?id=com.whatsapp");
    Intent playStore = new Intent(Intent.ACTION_VIEW, uri);


Answer Source

Short answer: This is not possible. You can not do this unless you build your own implementation for whatsapp api and in this case you will need sender phone number and password and this can not be done pragmatically. Long steps to do this will be as follow : 1 - bring rooted mobile phone and put sender sim card in 2 - get the files that whatsapp stores password in and get the password 3 - implement whatsapp mini client that, using this user name and password, send your message.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download