Send message to specific contact through whatsapp from another app

前端 未结 6 2355
无人共我
无人共我 2021-02-20 07:58

Is it possible to send message to a specific contact through whatsapp directly from another app? I know the contact ID. I don\'t want to open whatsapp

6条回答
  •  清歌不尽
    2021-02-20 08:35

    Please try this. Its working perfectly fine for me.

        Intent sendIntent = new Intent("android.intent.action.MAIN");
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.setPackage("com.whatsapp");
        sendIntent.setType("text/plain");
        sendIntent.putExtra("jid", "9194******22" + "@s.whatsapp.net");// here 91 is country code
        sendIntent.putExtra(Intent.EXTRA_TEXT, "Demo test message");
        startActivity(sendIntent);
    

提交回复
热议问题