> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/navigation/llms.txt)

# Avatar

Your browser doesn't support HTML5 video. Open [link to the video](https://docs.mapbox.com/android/android/assets/medias/dash-sdk-mapgpt-avatar-6905494bee3d7b4ccd03fc039dbc99d7.mp4).

The `MapGptAvatar` is an animating avatar displayed on-screen. This guide covers how to use avatars and how to construct your own.

## Using avatars

To update the avatar:

```kotlin
Dash.mapGptCompose.config.update {
    it.build {
        avatar = PrebuiltMapGptAvatars.mapboxyAvatar
    }
}
```

## Detaching Avatar from MapView

With `MapGPT`, you can detach the avatar from the map view to position it more widely on the screen and use it independently of the application.

```kotlin
private var detachableUI: MapGptDetachableUI? = null

override fun onCreate(savedInstanceState: Bundle?) {
    detachableUI = Dash.mapGptCompose.attachContent(binding.mapGptComposeView) {
        Dash.mapGptCompose.Avatar()
    }
}

override fun onDestroy() {
    detachableUI?.detach()
    detachableUI = null
}
```

## Creating a custom avatar

With `MapGPT`, you can introduce your custom avatar for a personalized experience. The avatar leverages a sequence of animations developed with the [Lottie](https://lottie.airbnb.tech/#/) library. These animations formats will be extended in the future, but our first version is using the [Lottie JSON format](https://lottiefiles.github.io/lottie-docs/schema/).

```kotlin
Dash.mapGptCompose.config.update {
    it.build {
        avatar = LottieMapGptAvatar(
            name = "Petter",
            listeningToUser = R.raw.ic_petter_listening_to_user,
            userSpeaking = R.raw.ic_petter_user_speaking,
            aiThinking = R.raw.ic_petter_ai_thinking,
            aiSpeaking = R.raw.ic_petter_ai_speaking,
            aiError = R.raw.ic_petter_ai_error,
            aiIdle = R.raw.ic_petter_listening_to_user,
            aiSleeping = R.raw.ic_petter_listening_to_user,
            noMicPermission = R.raw.ic_petter_listening_to_user,
            serviceDisconnected = R.raw.ic_petter_listening_to_user,
        )
    }
}
```

## Avatar state descriptions

-   **Listening to User**: The assistant is actively listening.
-   **User Speaking**: Indicates that the user is now speaking.
-   **AI Thinking**: Assistant is processing a response.
-   **AI Speaking**: Assistant is communicating a message.
-   **AI Error**: An error has been detected with the assistant.
-   **AI Idle**: Assistant is on standby for the next command.
-   **AI Sleeping**: Assistant hasn't been activated for an extended period.
-   **No Mic Permission**: The app lacks permission to access the microphone.
-   **Service Disconnected**: Assistant has lost connection and can't respond.