# IntentMonitor

# IntentMonitor

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/IntentMonitor.java+class:androidx.test.runner.intent.IntentMonitor)

*** ** * ** ***

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

<br />

```
interface IntentMonitor
```

<br />

*** ** * ** ***

Interface for tests to use when they need to monitor intents used to start activities from the current[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html).

Retrieve instances of the monitor through[).](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitorRegistry)

[Monitoring intents requires support from Instrumentation, therefore do not expect an instance to be present under any arbitrary instrumentation.](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitorRegistry)

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [addIntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor#addIntentCallback(androidx.test.runner.intent.IntentCallback))`(callback: `[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback)`!)` Adds an[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback), which will be notified when intents are sent from the current instrumentation process. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [removeIntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentMonitor#removeIntentCallback(androidx.test.runner.intent.IntentCallback))`(callback: `[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback)`!)` Removes a previously registered[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback).                                                          |

## Public functions

### addIntentCallback

```
fun addIntentCallback(callback: IntentCallback!): Unit
```

Adds an[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback), which will be notified when intents are sent from the current instrumentation process.  

### removeIntentCallback

```
fun removeIntentCallback(callback: IntentCallback!): Unit
```

Removes a previously registered[IntentCallback](https://developer.android.com/reference/kotlin/androidx/test/runner/intent/IntentCallback).