{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class ApplicationLifecycleMonitorRegistry
An exposed registry instance to make it easy for callers to find the application lifecycle monitor for their application.
Public functions |
|
|---|---|
ApplicationLifecycleMonitor |
Returns the ActivityLifecycleMonitor. |
Unit |
registerInstance(monitor: ApplicationLifecycleMonitor)Stores a lifecycle monitor in the registry. |
fun getInstance(): ApplicationLifecycleMonitor
Returns the ActivityLifecycleMonitor.
This monitor is not guaranteed to be present under all instrumentations.
| Returns | |
|---|---|
ApplicationLifecycleMonitor |
ActivityLifecycleMonitor the monitor for this application. |
| Throws | |
|---|---|
java.lang.IllegalStateException |
if no monitor has been registered. |
fun registerInstance(monitor: ApplicationLifecycleMonitor): Unit
Stores a lifecycle monitor in the registry.
This is a global registry - so be aware of the impact of calling this method!
| Parameters | |
|---|---|
monitor: ApplicationLifecycleMonitor |
the monitor for this application. Null deregisters any existing monitor. |