DefaultEmojiCompatConfig


class DefaultEmojiCompatConfig


The default config will use downloadable fonts to fetch the emoji compat font file.

It will automatically fetch the emoji compat font from a ContentProvider that is installed on the devices system image, if present.

You should use this if you want the default emoji font from a system installed downloadable fonts provider. This is the recommended behavior for all applications unless they install a custom emoji font.

You may need to specialize the configuration beyond this default config in some situations:

  • If you are trying to install a custom emoji font through downloadable fonts use FontRequestEmojiCompatConfig instead of this method.
  • If you're trying to bundle an emoji font with your APK use BundledEmojiCompatConfig in the emoji2-bundled artifact.
  • If you are building an APK that will be installed on devices that won't have a downloadable fonts provider, use BundledEmojiCompatConfig.

The downloadable font provider used by DefaultEmojiCompatConfig always satisfies the following contract:

  1. It MUST provide an intent filter for androidx.content.action.LOAD_EMOJI_FONT.
  2. It MUST respond to the query emojicompat-emoji-font with a valid emoji compat font file including metadata.
  3. It MUST provide fonts via the same contract as downloadable fonts.
  4. It MUST be installed in the system image.

Summary

Public functions

java-static FontRequestEmojiCompatConfig?
create(context: Context)

Get the default emoji compat config for this device.

Public functions

create

Added in 1.0.0
java-static fun create(context: Context): FontRequestEmojiCompatConfig?

Get the default emoji compat config for this device. You may further configure the returned config before passing it to init. Each call to this method will return a new EmojiCompat.Config, so changes to the returned object will not modify future return values.

Parameters
context: Context

context for lookup

Returns
FontRequestEmojiCompatConfig?

A valid config for downloading the emoji compat font, or null if no font provider could be found.