/emojicompat-sample

Primary LanguageKotlinApache License 2.0Apache-2.0

Android EmojiCompat Sample (Kotlin)

A quick demonstration of the various ways to Support Modern Emoji using Google's EmojiCompat library

Source initially copied from android/user-interface-samples/EmojiCompat

Dependency Versions

library version
appcompat 1.5.1
emoji2 1.2.0

Demo Apps

app-emojicompat-appcompat

Using AppCompat to support the latest emoji. AppCompat will invoke EmojiCompatInitializer at app startup.

app-emojicompat-bundled

Bundling the Noto Color Emoji Compat font by way of the emoji2-bundled artifact, as described here.

  • Invoking EmojiCompat.init(BundledEmojiCompatConfig(..)) during Application.onCreate.
  • Manifest provider for EmojiCompatInitializer is still present. Removing this as described here breaks the integration.

app-emojicompat-fontrequest

Launching a Font Request to download the Noto Color Emoji Compat font by initializing EmojiCompat with FontRequestEmojiCompatConfig.

Tests

EmojiCompat configurations that rely on FontRequest do not appear functional on an Android 11 Emulator with up-to-date Google Play Services. The steps to resolve this issue provided here have not resolved the issue.

Test: Multi-skin-toned handshake emoji should render successfully: 🫱🏿‍🫲🏻

Result: Only renders when EmojiCompat is initialized with BundledEmojiCompatConfig

Device AppCompat Bundled FontRequest
❌ Emulator
Android 11
(Pixel 4 with Playstore)
Running recent
version (22.39.15)
of Playstore
app-emojicompat-appcompat app-emojicompat-bundled app-emojicompat-fontrequest
✅ Real Device
Android 11
One Plus
real-device-app-emojicompat-appcompat real-device-app-emojicompat-bundled app-emojicompat-fontrequest

To Build

./gradlew assembleDebug
adb install -r -t ./app-emojicompat-bundled/build/outputs/apk/debug/app-emojicompat-bundled-debug.apk
adb install -r -t ./app-emojicompat-fontrequest/build/outputs/apk/debug/app-emojicompat-fontrequest-debug.apk
adb install -r -t ./app-emojicompat-appcompat/build/outputs/apk/debug/app-emojicompat-appcompat-debug.apk