Skip to content

Most visited

Recently visited

navigation
added in version 1.0.0
belongs to Maven artifact android.arch.lifecycle:extensions:1.0.0

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

From class java.lang.Object

Public constructors

ServiceLifecycleDispatcher

added in version 1.0.0
ServiceLifecycleDispatcher (LifecycleOwner provider)

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

Public methods

getLifecycle

added in version 1.0.0
Lifecycle getLifecycle ()

Returns
Lifecycle Lifecycle for the given LifecycleOwner

onServicePreSuperOnBind

added in version 1.0.0
void onServicePreSuperOnBind ()

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

onServicePreSuperOnCreate

added in version 1.0.0
void onServicePreSuperOnCreate ()

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

onServicePreSuperOnDestroy

added in version 1.0.0
void onServicePreSuperOnDestroy ()

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

onServicePreSuperOnStart

added in version 1.0.0
void onServicePreSuperOnStart ()

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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)