# DynamicInstallMonitor

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicInstallMonitor "View this page in Java")

<br />

```
class DynamicInstallMonitor
```

<br />

*** ** * ** ***

Monitor installation progress of dynamic feature modules. This class enables you to subscribe to the current installation state via getStatus. 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[DynamicExtras](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicExtras).

## Summary

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

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [cancelInstall](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#cancelInstall())`()` Cancel the current split installation session in the SplitInstallManager. |

|                                                                                                          ### Public properties                                                                                                          |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Exception](https://developer.android.com/reference/java/lang/Exception.html)`?`                                                                                                                                                        | [exception](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#exception()) The occurred exception, if any.                                                                                                                                                                          |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                     | [isInstallRequired](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#isInstallRequired()) Check whether an installation is required.                                                                                                                                               |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                             | [sessionId](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#sessionId()) The session id from Play Core for this installation session.                                                                                                                                             |
| [LiveData](https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData)`<`[SplitInstallSessionState](https://developer.android.com/reference/com/google/android/play/core/splitinstall/SplitInstallSessionState.html)`>` | [status](https://developer.android.com/reference/kotlin/androidx/navigation/dynamicfeatures/DynamicInstallMonitor#status()) Get a LiveData of[SplitInstallSessionStatus](https://developer.android.com/reference/com/google/android/play/core/splitinstall/model/SplitInstallSessionStatus.html)with updates on the installation progress. |

## Public constructors

### DynamicInstallMonitor

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

```
DynamicInstallMonitor()
```  

## Public functions

### cancelInstall

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

```
fun cancelInstall(): Unit
```

Cancel the current split installation session in the SplitInstallManager.  

## Public properties

### exception

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

```
val exception: Exception?
```

The occurred exception, if any.  

### isInstallRequired

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

```
val isInstallRequired: Boolean
```

Check whether an installation is required.

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

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if installation is required,`false`otherwise. |

### sessionId

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

```
val sessionId: Int
```

The session id from Play Core for this installation session.  

### status

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

```
val status: LiveData<SplitInstallSessionState>
```

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