register
abstract fun register(lifecycle: Lifecycle, runWhileStopped: Boolean = false, callback: OutputCallback<O>): OutputCallbackToken<O>
Content copied to clipboard
Registers callback paired with lifecycle to be invoked later.
Concrete implementations should release them when lifecycle be DESTROYED. Also, they should allow callback to be invoked when appropriate, given that a CallbackToken corresponding to the one returned is provided.
Return
A CallbackToken that identifies callback by it's origin, allowing it to be retrieved and invoked later.
Parameters
lifecycle
The Lifecycle which callback will be paired to.
callback
The callback to be registered. Will be released when lifecycle be destroyed. May be invoked only when lifecycle is in an active state, or in whatever state until lifecycle be destroyed, according to runWhileStopped's value.