Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send emoji in intent to whatsapp?

I know that we can send plain text to whatsapp through an intent like :

 Intent sendIntent = new Intent();
 sendIntent.setAction(Intent.ACTION_SEND);
 sendIntent.putExtra(Intent.EXTRA_TEXT,"Text to be sent on whatsapp");
 sendIntent.setType("text/plain");
 sendIntent.setPackage("com.whatsapp");
 startActivity(sendIntent);

But I want to be able to send emojis (emoticons) to whatsapp through an intent.
How is it possible? Do we have some special codes for the emojis?

like image 720
Gautam Jain Avatar asked Oct 05 '16 04:10

Gautam Jain


People also ask

How do I add an emoji to WhatsApp?

To use emoji, simply tap the icon to open the emoji selection menu. To switch back to your keyboard, tap the icon. Some emoji are available in different skin colors. If you want to select a different colored emoji, tap and hold the emoji you wish to use and select the color you want.

How do you use emoji reactions on WhatsApp?

To use any emoji for reaction, long-press on a message, tap on the + button and pick an emoji through the full list. You'll see the emoji you picked under the message. The new feature is just a fun visual addition that doesn't limit you from using six preset emoji.

Why can't I react to WhatsApp messages?

You need to be on the latest version of WhatsApp to get support for message reactions. To react to a message on iOS, iPadOS, and Android, press and hold the message and select the emoji of your choice to react.

How do you send emojis via text?

Tap and hold a message. Choose an emoji reaction.


1 Answers

I used StringBuilder for this like:

int unicode = 0x1F600
StringBuilder s = new StringBuilder();
s.append("YOUR MESSAGE HERE");
s.append(Character.toChars(unicode));

The resulting string will be something like this

YOUR MESSAGE HERE😀

Copy the unicode from here But remember to change the code that you will copy from this webpage from U-1F600 to 0x1F600.

U-1F600 is the unicode but android doesn't recognizes this. 0x1F600 is the hexcode for android.

like image 104
shivanshPurple Avatar answered Oct 12 '22 23:10

shivanshPurple