# EmojiCompatInitializer

Artifact: [androidx.emoji2:emoji2](https://developer.android.com/jetpack/androidx/releases/emoji2) [View Source](https://cs.android.com/search?q=file:androidx/emoji2/text/EmojiCompatInitializer.java+class:androidx.emoji2.text.EmojiCompatInitializer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

*** ** * ** ***


```
public class EmojiCompatInitializer implements Initializer<Boolean>
```

<br />

*** ** * ** ***

Initializer for configuring EmojiCompat with the system installed downloadable font provider.

This initializer will initialize EmojiCompat immediately then defer loading the font for a short delay to avoid delaying application startup. Typically, the font will be loaded shortly after the first screen of your application loads, which means users may see system emoji briefly prior to the compat font loading.

This is the recommended configuration for all apps that don't need specialized configuration, and don't need to control the background thread that initialization runs on. For more information see `https://developer.android.com/reference/androidx/emoji2/text/DefaultEmojiCompatConfig`.

In addition to the reasons listed in `DefaultEmojiCompatConfig` you may wish to disable this automatic configuration if you intend to call initialization from an existing background thread pool in your application.

This is enabled by default by including the `:emoji2:emoji2` gradle artifact. To disable the default configuration (and allow manual configuration) add this to your manifest:

```
    <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.androidx-startup"
        android:exported="false"
        tools:node="merge">
        <meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
                  tools:node="remove" />
    </provider>
```
This initializer depends on `https://developer.android.com/reference/androidx/lifecycle/ProcessLifecycleInitializer`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/emoji2/text/DefaultEmojiCompatConfig` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/emoji2/text/EmojiCompatInitializer#EmojiCompatInitializer()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Boolean.html` | `https://developer.android.com/reference/androidx/emoji2/text/EmojiCompatInitializer#create(android.content.Context)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` Initialize EmojiCompat with the app's context. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Class.html<https://developer.android.com/reference/androidx/startup/Initializer<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>>` | `https://developer.android.com/reference/androidx/emoji2/text/EmojiCompatInitializer#dependencies()()` Dependes on ProcessLifecycleInitializer |

## Public constructors

### EmojiCompatInitializer

Added in 1.0.0

```
public EmojiCompatInitializer()
```

## Public methods

### create

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
public @NonNull Boolean create(@NonNull Context context)
```

Initialize EmojiCompat with the app's context.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | application context |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Boolean.html` | result of default init |

### dependencies

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
public @NonNull List<Class<Initializer<@NonNull ?>>> dependencies()
```

Dependes on ProcessLifecycleInitializer