on State Changed

open override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event)

method to register and unregister based on Lifecycle event

Sources

Link copied to clipboard