# FontRequestEmojiCompatConfig

# FontRequestEmojiCompatConfig

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/emoji/text/FontRequestEmojiCompatConfig "View this page in Java")

<br />

```
class FontRequestEmojiCompatConfig : EmojiCompat.Config
```

<br />

|---|---|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                        |||
| ↳ | [androidx.emoji.text.EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)                        ||
|   | ↳ | [androidx.emoji.text.FontRequestEmojiCompatConfig](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig) |

*** ** * ** ***

[EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)implementation that asynchronously fetches the required font and the metadata using a[FontRequest](https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest). FontRequest should be constructed to fetch an EmojiCompat compatible emoji font.

## Summary

|                                                                                                                                                                                                                 ### Nested types                                                                                                                                                                                                                  |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy)` : `[FontRequestEmojiCompatConfig.RetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy) A retry policy implementation that doubles the amount of time in between retries. |
| `abstract class `[FontRequestEmojiCompatConfig.RetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy) Retry policy used when the font provider is not ready to give the font file.                                                                                                                                                                                             |

|                                                                                                                                                                                                       ### Public constructors                                                                                                                                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [FontRequestEmojiCompatConfig](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig#FontRequestEmojiCompatConfig(android.content.Context,androidx.core.provider.FontRequest))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, request: `[FontRequest](https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest)`)` |

|                                                        ### Public functions                                                        |
|------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [FontRequestEmojiCompatConfig](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig)`!` | [setHandler](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig#setHandler(android.os.Handler))`(handler: `[Handler](https://developer.android.com/reference/android/os/Handler.html)`!)` Sets the custom handler to be used for initialization.                                                                                               |
| [FontRequestEmojiCompatConfig](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig)`!` | [setRetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig#setRetryPolicy(androidx.emoji.text.FontRequestEmojiCompatConfig.RetryPolicy))`(policy: `[FontRequestEmojiCompatConfig.RetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy)`!)` Sets the retry policy. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.emoji.text.EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config) |----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [EmojiCompat.MetadataRepoLoader](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.MetadataRepoLoader)`!` | [getMetadataRepoLoader](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#getMetadataRepoLoader())`()` Returns the[MetadataRepoLoader](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.MetadataRepoLoader).                                                                                                                                                                                                                                                                                                                                                          | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [registerInitCallback](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#registerInitCallback(androidx.emoji.text.EmojiCompat.InitCallback))`(initCallback: `[EmojiCompat.InitCallback](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.InitCallback)`)` Registers an initialization callback.                                                                                                                                                                                                                                                                       | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setEmojiSpanIndicatorColor](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setEmojiSpanIndicatorColor(int))`(color: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the color used as emoji span indicator.                                                                                                                                                                                                                                                     | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setEmojiSpanIndicatorEnabled](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setEmojiSpanIndicatorEnabled(boolean))`(emojiSpanIndicatorEnabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Determines whether a background will be drawn for the emojis that are found and replaced by EmojiCompat.                                                                                                                                                                                                                                                | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)                            | [setGlyphChecker](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setGlyphChecker(androidx.emoji.text.EmojiCompat.GlyphChecker))`(glyphChecker: `[EmojiCompat.GlyphChecker](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.GlyphChecker)`)` The interface that is used by EmojiCompat in order to check if a given emoji can be rendered by the system.                                                                                                                                                                                                           | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setMetadataLoadStrategy](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setMetadataLoadStrategy(int))`(strategy: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Determines the strategy to start loading the metadata.                                                                                                                                                                                                                                                                                                                                         | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setReplaceAll](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setReplaceAll(boolean))`(replaceAll: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Determines whether EmojiCompat should replace all the emojis it finds with the EmojiSpans.                                                                                                                                                                                                                                                                                                           | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setUseEmojiAsDefaultStyle](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean))`(useEmojiAsDefaultStyle: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Determines whether EmojiCompat should use the emoji presentation style for emojis that have text style as default.                                                                                                                                                                                                                                               | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [setUseEmojiAsDefaultStyle](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean,java.util.List<java.lang.Integer>))`(` ` useEmojiAsDefaultStyle: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` emojiAsDefaultStyleExceptions: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`!>?` `)` | | [EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config)`!`                         | [unregisterInitCallback](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.Config#unregisterInitCallback(androidx.emoji.text.EmojiCompat.InitCallback))`(initCallback: `[EmojiCompat.InitCallback](https://developer.android.com/reference/kotlin/androidx/emoji/text/EmojiCompat.InitCallback)`)` Unregisters a callback that was added before.                                                                                                                                                                                                                                                           | |

## Public constructors

### FontRequestEmojiCompatConfig

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

```
FontRequestEmojiCompatConfig(context: Context, request: FontRequest)
```  

|                                                 Parameters                                                  |
|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)                  | Context instance, cannot be`null`                                                                                                                 |
| `request: `[FontRequest](https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest) | [FontRequest](https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest)to fetch the font asynchronously, cannot be`null` |

## Public functions

### setHandler

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

```
fun setHandler(handler: Handler!): FontRequestEmojiCompatConfig!
```

Sets the custom handler to be used for initialization. Since font fetch take longer time, the metadata loader will fetch the fonts on the background thread. You can pass your own handler for this background fetching. This handler is also used for retrying.  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `handler: `[Handler](https://developer.android.com/reference/android/os/Handler.html)`!` | A[Handler](https://developer.android.com/reference/android/os/Handler.html)to be used for initialization. Can be`null`. In case of`null`, the metadata loader creates own[HandlerThread](https://developer.android.com/reference/android/os/HandlerThread.html)for initialization. |

### setRetryPolicy

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

```
fun setRetryPolicy(policy: FontRequestEmojiCompatConfig.RetryPolicy!): FontRequestEmojiCompatConfig!
```

Sets the retry policy. {@see RetryPolicy}  

|                                                                              Parameters                                                                              |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `policy: `[FontRequestEmojiCompatConfig.RetryPolicy](https://developer.android.com/reference/kotlin/androidx/emoji/text/FontRequestEmojiCompatConfig.RetryPolicy)`!` | The policy to be used when the font provider is not ready to give the font file. Can be`null`. In case of`null`, the metadata loader never retries. |