# IntentMonitorRegistry

# IntentMonitorRegistry

Artifact:[androidx.test:monitor](https://developer.android.com/jetpack/androidx/releases/test)  
[View Source](https://cs.android.com/search?q=file:androidx/test/runner/intent/IntentMonitorRegistry.java+class:androidx.test.runner.intent.IntentMonitorRegistry)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/runner/intent/IntentMonitorRegistry "View this page in Java")

<br />

```
class IntentMonitorRegistry
```

<br />

*** ** * ** ***

Exposes an implementation of[IntentMonitor](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor)to users.

## Summary

|                                                    ### Public functions                                                    |
|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[IntentMonitor](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor)`!` | [getInstance](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitorRegistry#getInstance())`()` Returns the IntentMonitor.                                                                                                                                                                                                                                                                                                 |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                | [registerInstance](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitorRegistry#registerInstance(androidx.test.runner.intent.IntentMonitor))`(monitor: `[IntentMonitor](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor)`!)` Stores the given[IntentMonitor](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor)instance in the registry. |

## Public functions

### getInstance

```
java-static fun getInstance(): IntentMonitor!
```

Returns the IntentMonitor. This monitor is not guaranteed to be present under all' instrumentations.  

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if no monitor has been registered. |

### registerInstance

```
java-static fun registerInstance(monitor: IntentMonitor!): Unit
```

Stores the given[IntentMonitor](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor)instance in the registry. Passing null removes the monitor from the registry.