Reputation: 705
There is a chat software that is supported on Android versions ranging from 4.0 to 6.0. iOS is supported too. Recently we've introduced option to use system emojis. However, when someone with latest Android, or iOS, sends message containing latest emoji, the older device can't display it properly.
Is there a way to detect those emojis that can't be displayed? We want to replace those with some symbol (eg. an empty box or exclamation mark)
Upvotes: 2
Views: 3204
Reputation: 936
please check the source code from Googles Mozc project. The EmojiRenderableChecker class seems to work pretty well!
it's like a compat version for Paint.hasGlypgh (added in Marshmallow).
Upvotes: 1
Reputation: 743
Get the system stock emojis Emojis - Unicode - Bytes.
Then search the recieved message, if you found some code that it's in your android version emojis diplay it, if not add the symbol you want.
Following the comments you can test it with this
Typeface typeface;
//initialize the custom font here
//enter the character to test
String charToTest="\u0978";
Paint paint=new Paint();
paint.setTypeface(typeface);
boolean hasGlyph=paint.hasGlyph(charToTest);
Upvotes: 2