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

ProcessLifecycleOwner

public class ProcessLifecycleOwner
extends Object implements LifecycleOwner

java.lang.Object
   ↳ android.arch.lifecycle.ProcessLifecycleOwner


Class that provides lifecycle for the whole application process.

You can consider this LifecycleOwner as the composite of all of your Activities, except that ON_CREATE will be dispatched once and ON_DESTROY will never be dispatched. Other lifecycle events will be dispatched with following rules: ProcessLifecycleOwner will dispatch ON_START, ON_RESUME events, as a first activity moves through these events. ON_PAUSE, ON_STOP, events will be dispatched with a delay after a last activity passed through them. This delay is long enough to guarantee that ProcessLifecycleOwner won't send any events if activities are destroyed and recreated due to a configuration change.

It is useful for use cases where you would like to react on your app coming to the foreground or going to the background and you don't need a milliseconds accuracy in receiving lifecycle events.

Summary

Public methods

static LifecycleOwner get()

The LifecycleOwner for the whole application process.

Lifecycle getLifecycle()

Returns the Lifecycle of the provider.

Inherited methods

From class java.lang.Object
From interface android.arch.lifecycle.LifecycleOwner

Public methods

get

added in version 1.0.0
LifecycleOwner get ()

The LifecycleOwner for the whole application process. Note that if your application has multiple processes, this provider does not know about other processes.

Returns
LifecycleOwner LifecycleOwner for the whole application.

getLifecycle

added in version 1.0.0
Lifecycle getLifecycle ()

Returns the Lifecycle of the provider.

Returns
Lifecycle The lifecycle of the provider.

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.
(Sep 2017 survey)