ServiceLifecycleDispatcher

open class ServiceLifecycleDispatcher
kotlin.Any
   ↳ androidx.lifecycle.ServiceLifecycleDispatcher

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

Summary

Public constructors
<init>(@NonNull provider: LifecycleOwner)

Public methods
open Unit

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

open Unit

Must be a first call in Service#onBind(Intent) method, even before super.

open Unit

Must be a first call in Service#onDestroy() method, even before super.

open Unit

Must be a first call in Service#onStart(Intent, int) or Service#onStartCommand(Intent, int, int) methods, even before a corresponding super call.

open Lifecycle

Public constructors

<init>

ServiceLifecycleDispatcher(@NonNull provider: LifecycleOwner)
Parameters
provider LifecycleOwner: LifecycleOwner for a service, usually it is a service itself

Public methods

onServicePreSuperOnCreate

open fun onServicePreSuperOnCreate(): Unit

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

onServicePreSuperOnBind

open fun onServicePreSuperOnBind(): Unit

Must be a first call in Service#onBind(Intent) method, even before super.onBind call.

onServicePreSuperOnDestroy

open fun onServicePreSuperOnDestroy(): Unit

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

onServicePreSuperOnStart

open fun onServicePreSuperOnStart(): Unit

Must be a first call in Service#onStart(Intent, int) or Service#onStartCommand(Intent, int, int) methods, even before a corresponding super call.

getLifecycle

@NonNull open fun getLifecycle(): Lifecycle
Return
Lifecycle: Lifecycle for the given LifecycleOwner