ServiceLifecycleDispatcher

open class ServiceLifecycleDispatcher


Helper class to dispatch lifecycle events for a Service. Use it only if it is impossible to use LifecycleService.

Summary

Public constructors

Public functions

open Unit

Must be a first call in Service.onBind method, even before super.onBind call.

open Unit

Must be a first call in Service.onCreate method, even before super.onCreate call.

open Unit

Must be a first call in Service.onDestroy method, even before super.OnDestroy call.

open Unit

Must be a first call in Service.onStart or Service.onStartCommand methods, even before a corresponding super call.

Public properties

open Lifecycle

Lifecycle for the given LifecycleOwner

Public constructors

ServiceLifecycleDispatcher

Added in 2.0.0
ServiceLifecycleDispatcher(provider: LifecycleOwner)
Parameters
provider: LifecycleOwner

LifecycleOwner for a service, usually it is a service itself

Public functions

onServicePreSuperOnBind

Added in 2.0.0
open fun onServicePreSuperOnBind(): Unit

Must be a first call in Service.onBind method, even before super.onBind call.

onServicePreSuperOnCreate

Added in 2.0.0
open fun onServicePreSuperOnCreate(): Unit

Must be a first call in Service.onCreate method, even before super.onCreate call.

onServicePreSuperOnDestroy

Added in 2.0.0
open fun onServicePreSuperOnDestroy(): Unit

Must be a first call in Service.onDestroy method, even before super.OnDestroy call.

onServicePreSuperOnStart

Added in 2.0.0
open fun onServicePreSuperOnStart(): Unit

Must be a first call in Service.onStart or Service.onStartCommand methods, even before a corresponding super call.

Public properties

lifecycle

Added in 2.0.0
open val lifecycleLifecycle

Lifecycle for the given LifecycleOwner