# OnDeviceExtension


```
@PublicPreviewAPI
public final class OnDeviceExtension
```

<br />

*** ** * ** ***

Extension class for performing on-device operations.

## Summary

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceModelStatus` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceExtension#checkStatus()()` Checks the current status / availability of the on-device AI model. |
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/DownloadStatus>` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceExtension#download()()` Initiates the download of the on-device AI model. |
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://developer.android.com/reference/kotlin/java/lang/String.html` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceExtension#getModelName()()` Returns the name of the on-device model. |
| `final void` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceExtension#warmUp()()` Warms up the model to reduce latency for the first request. |

## Public methods

### checkStatus

```
public final @NonNull OnDeviceModelStatus checkStatus()
```

Checks the current status / availability of the on-device AI model.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceModelStatus` | An `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/OnDeviceModelStatus` object indicating the current state of the model. |

### download

```
public final @NonNull Flow<@NonNull DownloadStatus> download()
```

Initiates the download of the on-device AI model.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/DownloadStatus>` | A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/DownloadStatus` objects representing the download lifecycle. |

### getModelName

```
public final @NonNull String getModelName()
```

Returns the name of the on-device model.

### warmUp

```
public final void warmUp()
```

Warms up the model to reduce latency for the first request.

| Throws |
|---|---|
| `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/FirebaseAIException com.google.firebase.ai.type.FirebaseAIException` | if the warmup failed. |