Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use whatsapp from my Android app?

Tags:

android

This is how I am calling the SMS app:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
            sendIntent.putExtra("sms_body", "The SMS text"); 
            sendIntent.setType("vnd.android-dir/mms-sms");

            startActivity(sendIntent);   

How do I do the same for sending messages via twitter/Whatsapp/Facebook? What should I write in place of mms-sms? I found no documentation on such.

like image 872
Hick Avatar asked Mar 14 '12 17:03

Hick


People also ask

Can you have WhatsApp on 2 devices?

You can use up to four linked devices and one phone at a time. Your personal messages, media, and calls are end-to-end encrypted. Each linked device connects to WhatsApp independently while maintaining the same level of privacy and security through end-to-end encryption that people who use WhatsApp have come to expect.

How can I use WhatsApp on two devices with same number?

Open WhatsApp Web through ( https://web.whatsapp.com/ ) on your secondary phone. If you're using Chrome browser, click on the three dots at the top right side corner and select the desktop view option. Scan the code from the screen and you'll be ready to access WhatsApp of the same number on the secondary phone.


1 Answers

I can't also find any way of calling Facebook/Twitter directly, but you could always call android.content.Intent.ACTION_SEND and let the user choose the application.

Android ACTION_SEND intent

Intent i = new Intent(android.content.Intent.ACTION_SEND);

i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
i.putExtra(Intent.EXTRA_TEXT, "Message body");

startActivity(Intent.createChooser(i, "Share dialog title"));

However, there might be a bug when using this to share through Facebook. For more information please see: Android Facebook Intent

like image 152
Telmo Marques Avatar answered Sep 18 '22 02:09

Telmo Marques