# DynamicInstallMonitor

Artifact: [androidx.navigation:navigation-dynamic-features-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/dynamicfeatures/DynamicInstallMonitor.kt+class:androidx.navigation.dynamicfeatures.DynamicInstallMonitor) Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

*** ** * ** ***


```
public final class DynamicInstallMonitor
```

<br />

*** ** * ** ***

Monitor installation progress of dynamic feature modules. This class enables you to subscribe to the current installation state via `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#status()`. You also can perform various checks on installation state directly through this monitor.

In order to enable installation and monitoring of progress you'll have to provide an instance of this class to `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicExtras`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#DynamicInstallMonitor()()` |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#cancelInstall()()` Cancel the current split installation session in the SplitInstallManager. |
| `final https://developer.android.com/reference/java/lang/Exception.html` | `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#getException()()` The occurred exception, if any. |
| `final int` | `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#getSessionId()()` The session id from Play Core for this installation session. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/com/google/android/play/core/splitinstall/SplitInstallSessionState.html>` | `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#getStatus()()` Get a LiveData of `https://developer.android.com/reference/com/google/android/play/core/splitinstall/model/SplitInstallSessionStatus.html` with updates on the installation progress. |
| `final boolean` | `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#isInstallRequired()()` Check whether an installation is required. |

## Public constructors

### DynamicInstallMonitor

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

```
public DynamicInstallMonitor()
```

## Public methods

### cancelInstall

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

```
public final void cancelInstall()
```

Cancel the current split installation session in the SplitInstallManager.

### getException

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

```
public final Exception getException()
```

The occurred exception, if any.

### getSessionId

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

```
public final int getSessionId()
```

The session id from Play Core for this installation session.

### getStatus

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

```
public final @NonNull LiveData<@NonNull SplitInstallSessionState> getStatus()
```

Get a LiveData of `https://developer.android.com/reference/com/google/android/play/core/splitinstall/model/SplitInstallSessionStatus.html` with updates on the installation progress.

### isInstallRequired

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

```
public final boolean isInstallRequired()
```

Check whether an installation is required.

If this returns `true`, you should observe the LiveData returned by `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#status()` for installation updates and handle them accordingly.

| Returns |
|---|---|
| `boolean` | `true` if installation is required, `false` otherwise. |