Reputation: 1792
I implement the functionality of push Notification in my app. This display text message in push notification but emoji not display. It display ascii code like '\u270c' instead of emoji.
can anyone tell me how to display emoji in push notification
Upvotes: 0
Views: 4008
Reputation: 1792
To display Emoji in Push Notification use JSON Decoding at server side. It solves this issue for me Do this at server side in APNS push notification code and will work like charm
$payload['aps'] = array('alert' => json_decode('"'.$pushMsg['message'].'"'), 'badge' => 0, 'sound' => 'default', 'passcode' => $pushMsg);
Upvotes: 4
Reputation: 5823
You need to change your unicode format to display emoji in push notification and local notification.
Update your unicode as follows:
"\u{270c}"
I hope this will help you.
Reference: https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html
Upvotes: 0