I am trying to send Push Notification with payload for IOS, payload has limited size which is 256 byte so when Push Notification message has emoji or different than text I can not detect actual message size as a result payload size excedd 256 byte, How can I detect actual size of message with using java ? thanks
Asked
Active
Viewed 247 times
2 Answers
0
As far as I know, emoji are 4 bytes in size. (Feel free to correct me if I'm wrong)
So as long as you can detect how many emoji are there in the message you can account for them each being 4 bytes in size.
As for how to detect how many emoji there are, it probably depends on what data you receive to parse.
Technically they are just Unicode characters so you should be able to see and identify them in some raw output, provided your output can acknowledge Unicode 6.0 characters.

Ceiling Gecko
- 3,104
- 2
- 24
- 33
0
Finally, we all need to use that,
int actualSize = message.getBytes("UTF-8").length;
it gives us a actual size of the message.

Poyraz
- 359
- 1
- 5
- 12