# IntentMonitor

# IntentMonitor

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


interface
IntentMonitor
`  
`


`

|--------------------------------------------------|
| android.support.test.runner.intent.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 {@link IntentMonitorRegistry).

Monitoring intents requires support from Instrumentation, therefore do not expect an instance to be present under any arbitrary instrumentation.

## Summary

|                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                               ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void` | ` `[addIntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentMonitor#addIntentCallback(android.support.test.runner.intent.IntentCallback))`(`[IntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentCallback)` callback) ` Adds an[IntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentCallback), which will be notified when intents are sent from the current instrumentation process. |
| ` abstract void` | ` `[removeIntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentMonitor#removeIntentCallback(android.support.test.runner.intent.IntentCallback))`(`[IntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentCallback)` callback) ` Removes a previously registered[IntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentCallback).                                                          |

## Public methods

### addIntentCallback

```
void addIntentCallback (IntentCallback callback)
```

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

<br />

|             Parameters              ||
|------------|-------------------------|
| `callback` | `IntentCallback` <br /> |

### removeIntentCallback

```
void removeIntentCallback (IntentCallback callback)
```

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

<br />

|             Parameters              ||
|------------|-------------------------|
| `callback` | `IntentCallback` <br /> |

-

  ## Interfaces

  - [IntentCallback](https://developer.android.com/reference/android/support/test/runner/intent/IntentCallback)
  - [IntentMonitor](https://developer.android.com/reference/android/support/test/runner/intent/IntentMonitor)
  - [IntentStubber](https://developer.android.com/reference/android/support/test/runner/intent/IntentStubber)
-

  ## Classes

  - [IntentMonitorRegistry](https://developer.android.com/reference/android/support/test/runner/intent/IntentMonitorRegistry)
  - [IntentStubberRegistry](https://developer.android.com/reference/android/support/test/runner/intent/IntentStubberRegistry)