[Free] WhatsApp write number and message, WhatsApp ready to send


#1

Maybe there are extensions similar to this, but a user asked me the possibility of providing it for multiple users.

It is simply an adaptation of the StackOverflow code:
https://stackoverflow.com/questions/36344892/how-can-i-send-message-to-specific-contact-through-whatsapp-from-my-android-app

private void shareToOneWhatsAppUser(String message) {

/**
 * NOTE:
 * Message is shared with only one user at a time. and to navigate back to main application user need to click back button
 */
Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("text/plain");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_TEXT, message);

//Directly send to specific mobile number...
String smsNumber = "919900990099";//Number without with country code and without '+' prifix
whatsappIntent.putExtra("jid", smsNumber + "@s.whatsapp.net"); //phone number without "+" prefix

if (whatsappIntent.resolveActivity(getPackageManager()) == null) {
    Toast.makeText(MainActivity.this, "Whatsapp not installed.", Toast.LENGTH_SHORT).show();
    return;
}

startActivity(whatsappIntent);

}
Multiple user
private void shareToMultipleWhatsAppUser(String message) {

/**
 * NOTE:
 *
 * If want to send same message to multiple users then have to select the user to whom you want to share the message & then click send.
 * User navigate back to main Application once he/she select all desired persons and click send button.
 * No need to click Back Button!
 */

Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("text/plain");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_TEXT, message);

if (whatsappIntent.resolveActivity(getPackageManager()) == null) {
    Toast.makeText(MainActivity.this, "Whatsapp not installed.", Toast.LENGTH_SHORT).show();
    return;
}

startActivity(whatsappIntent);

}
/////////////////////////////////////////////////////////////////////////////////

whatsapp

com.KIO4_WhatsApp.aix (6.5 KB)

http://kio4.com/appinventor/294D_extension_whatsapp.htm


#2

These are messages from StackOverflow:

_ I’ve tried this code. It works but it’s not exactly ‘sending’ it. It entered the text and now the user need to press ‘send’ button manually. Is it possible to just directly send it without waiting for the user to press the ‘send’ button?

It is not possible, because WhatsApp have his own privacy and security politycs and is being used by our applications through an intent, for that reason we can´t trigger the “send” button, we only can configure a message and contact to send it, but final users must have the last choice to “send” our automatic messages to their contacts.


#3

yes, we already have some solutions, which are able to send messages using Whatsapp…
see also How to start Whatsapp/send a message with Whatsapp or the Sharing extension

btw. please remember to follow the naming conventions…
naming

Taifun


#4

I make whatsapp status saver app vai thunkabke
Click here for aia file
Watch full video because link in video.