Joseph Mekwan
Joseph Mekwan

Reputation: 1092

Android How to send and Receive emoji smiley to the server (API)

This is question is possible like How to send and receive Emoji to webservice

By asking my question in different way here in hopes to find an exact solution.

In my apps, I have to create group name and send this name to the server (api) and display it in list.

But I have faced a problem when creating group with Emoji smiley; and also, in my list, instead of the smiley, it is displaying something different characters like "??" or other special characters.

In many stack overflow question, I searched about it but all of them tell about sending it as Unicode and receiving it as an image.

So my question is that, I have so many smileys; so how to check which smiley to be sent so that I can send that particular Unicode. Or how to convert all smileys to Unicode while sending them to api-server? And how to re-convert when receiving from the API to display in list?

I have smiley like following from the Git libs.

enter image description here

So, please help me to find out exactly how to send and receive smiley in server-api.

Upvotes: 2

Views: 4748

Answers (1)

Nirav Mehta
Nirav Mehta

Reputation: 1755

You can achieve send and receive smiley to server-API and vice verse ,through This libs https://github.com/Hall/androidemojimap

Encode emoji smiley : emoji smiley to unicode :

In that library method replaceUnicodeEmojis("your emoji string"); help you to convert emoji smiley to Unicode conversion (encode) , means this method used when you sending your smiley to server(in api). your emoji smiley string pass in this method.

call while send to api ;

EmojiMapUtil.replaceUnicodeEmojis("Your Smiley String");

In reverse process Decode smiley : unicode to smiley :

When you want to show this emoji to your list , decode smiley web-service result , through replaceCheatSheetEmojis(""); method. pass your smiley web-service string into this method.

call when got from the web-service :

EmojiMapUtil.replaceCheatSheetEmojis("web service result string");

Now you got that you want both encoding and decoding do through this.

Works like :

String cheatSheetString = EmojiMapUtil.replaceUnicodeEmojis("☃")
// cheatSheet = ":snowman:"
String emojiString = EmojiMapUtil.replaceUnicodeEmojis(":snowman:")
// emojiString = "☃"

Download all lib-code from the here : https://github.com/Hall/androidemojimap

Upvotes: 3

Related Questions