Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.1.0
belongs to Maven artifact android.arch.lifecycle:extensions:1.1.1

ServiceLifecycleDispatcher

public class ServiceLifecycleDispatcher
extends Object

java.lang.Object
   ↳ android.arch.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 onBind(Intent) method, even before super.onBind call.

void onServicePreSuperOnCreate()

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

void onServicePreSuperOnDestroy()

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

void onServicePreSuperOnStart()

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

Inherited methods

Public constructors

ServiceLifecycleDispatcher

added in version 1.1.0
ServiceLifecycleDispatcher (LifecycleOwner provider)

Parameters
provider LifecycleOwner: LifecycleOwner for a service, usually it is a service itself

Public methods

getLifecycle

added in version 1.1.0
Lifecycle getLifecycle ()

Returns
Lifecycle Lifecycle for the given LifecycleOwner

onServicePreSuperOnBind

added in version 1.1.0
void onServicePreSuperOnBind ()

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

onServicePreSuperOnCreate

added in version 1.1.0
void onServicePreSuperOnCreate ()

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

onServicePreSuperOnDestroy

added in version 1.1.0
void onServicePreSuperOnDestroy ()

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

onServicePreSuperOnStart

added in version 1.1.0
void onServicePreSuperOnStart ()

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