ServiceLifecycleDispatcher



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

Summary

Public constructors

android

Public functions

open Unit

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

android
open Unit

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

android
open Unit

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

android
open Unit

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

android

Public properties

open Lifecycle

Lifecycle for the given LifecycleOwner

android

Public constructors

ServiceLifecycleDispatcher

ServiceLifecycleDispatcher(provider: LifecycleOwner)
Parameters
provider: LifecycleOwner

LifecycleOwner for a service, usually it is a service itself

Public functions

onServicePreSuperOnBind

open fun onServicePreSuperOnBind(): Unit

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

onServicePreSuperOnCreate

open fun onServicePreSuperOnCreate(): Unit

Must be a first call in Service.onCreate method, even before super.onCreate 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 or Service.onStartCommand methods, even before a corresponding super call.

Public properties

lifecycle

open val lifecycleLifecycle

Lifecycle for the given LifecycleOwner