Since I found some older posts, that tell that whatsapp doesn't support this, I was wondering if something had changed and if there is a way to open a whatsapp 'chat' with a number that I'm sending through an intent?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Try this, this code launch WhatsApp via Intent.ACTION_VIEW, don't forget to use country code to the phone number.
I'm really late here but I believe that nowadays we have shorter and better solutions to send messages through WhatsApp.
You can use the following to call the system picker, then choose which app you will use to share whatever you want.
If you are really need to send through WhatsApp all you need to do is the following (You will skip the system picker)
If you need more information you can find it here: WhatsApp FAQ
get the contact number whom you want to send the message and create uri for whatsapp, here c is a Cursor returning the selected contact.
This works to me:
Tested on Marshmallow S5 and it works!
This will open a direct chat with a person, if whatsup not installed this will throw exception, if phone number not known to whatsup they will offer to send invite via sms or simple sms message
The following API can be used in c++ as shown in my article.
You need to define several constants:
Then you connect to the API’s endpoint.
Then send both header and body and wait for the result that needs to be “OK”.
Step 1 - open an HTTP request:
Step 2 - send the header:
Step 3 - send the message:
Now just check the result: