7

I need to show some emojis on setContentText on NotificationCompat like Whatsapp shows.

I have tried to use the softbank and some variations, nothing work. (see Emoji on Android Notification) Like Gabe Sechan suggested, probably the default font on NotificationCompat doesn't support emojis.

Is there a way to change the default font on NotificationCompat? If not, how does whatsapp shows emojis on its notifications?

Thanks.

Community
  • 1
  • 1
MaurĂ­cio Giordano
  • 3,116
  • 4
  • 32
  • 60

1 Answers1

7

This is the only way I got it working:

Spanned mssg;
mssg = Html.fromHtml(URLDecoder.decode("%F0%9F%98%82"));

It may vary depending on how do you receive your text, in my case i'm sending the emojicons using unicode to a GCM server and I don't have to worry about the URLDecoder, but if I receive a message sent from a emojicon PHP library and not from an android device the only way to show it properly was with the URLDecoder.

So if you're working with GCM it should be working with just

Spanned mssg;
mssg = Html.fromHtml(intent.getStringExtra("message"));

Hope it helps!

Alan Poggetti
  • 568
  • 5
  • 16