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 Lifecycle | |
open Unit |
Must be a first call in |
open Unit |
Must be a first call in |
open Unit |
Must be a first call in |
open Unit |
Must be a first call in |
Public constructors
<init>
ServiceLifecycleDispatcher(@NonNull provider: LifecycleOwner)
Parameters | |
---|---|
provider |
LifecycleOwner: LifecycleOwner for a service, usually it is a service itself |
Public methods
getLifecycle
@NonNull open fun getLifecycle(): Lifecycle
Return | |
---|---|
Lifecycle: Lifecycle for the given LifecycleOwner |
onServicePreSuperOnBind
open fun onServicePreSuperOnBind(): Unit
Must be a first call in Service#onBind(Intent)
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(Intent, int)
or Service#onStartCommand(Intent, int, int)
methods, even before a corresponding super call.