ServiceLifecycleDispatcher
public
class
ServiceLifecycleDispatcher
extends Object
| java.lang.Object | |
| ↳ | 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 | |
|---|---|
ServiceLifecycleDispatcher(LifecycleOwner provider)
|
|
Public methods | |
|---|---|
Lifecycle
|
getLifecycle()
|
void
|
onServicePreSuperOnBind()
Must be a first call in |
void
|
onServicePreSuperOnCreate()
Must be a first call in |
void
|
onServicePreSuperOnDestroy()
Must be a first call in |
void
|
onServicePreSuperOnStart()
Must be a first call in |
Inherited methods | |
|---|---|
Public constructors
ServiceLifecycleDispatcher
public ServiceLifecycleDispatcher (LifecycleOwner provider)
| Parameters | |
|---|---|
provider |
LifecycleOwner: LifecycleOwner for a service, usually it is a service itself
|
Public methods
getLifecycle
public Lifecycle getLifecycle ()
| Returns | |
|---|---|
Lifecycle |
Lifecycle for the given LifecycleOwner
|
onServicePreSuperOnBind
public void onServicePreSuperOnBind ()
Must be a first call in Service.onBind(Intent) method, even before super.onBind
call.
onServicePreSuperOnCreate
public void onServicePreSuperOnCreate ()
Must be a first call in Service.onCreate() method, even before super.onCreate call.
onServicePreSuperOnDestroy
public void onServicePreSuperOnDestroy ()
Must be a first call in Service.onDestroy() method, even before super.OnDestroy
call.
onServicePreSuperOnStart
public void onServicePreSuperOnStart ()
Must be a first call in Service.onStart(Intent, int) or
Service.onStartCommand(Intent, int, int) methods, even before
a corresponding super call.