How can I send message to specific contact through WhatsApp from my android app?

前端 未结 13 1586
梦毁少年i
梦毁少年i 2020-12-02 17:41

I am developing an android app and I need to send a message to specific contact from WhatsApp. I tried this code:

Uri mUri = Uri.parse(\"smsto:+999999999\");         


        
13条回答
  •  半阙折子戏
    2020-12-02 18:22

    This new method, send message to a specific contact via whatsapp in Android. For more information look here

                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_VIEW);
                String url = "https://api.whatsapp.com/send?phone=" + number + "&text=" + path;
                sendIntent.setData(Uri.parse(url));
                activity.startActivity(sendIntent);here
    

提交回复
热议问题