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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With