Stay organized with collections
Save and categorize content based on your preferences.
added in
version 1.1.0
belongs to Maven artifact android.arch.lifecycle:extensions:1.1.1
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
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
|
Public methods
get
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.
getLifecycle
Lifecycle getLifecycle ()
Returns the Lifecycle of the provider.
Returns |
Lifecycle |
The lifecycle of the provider.
|
Annotations
Interfaces
Classes
Enums
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ProcessLifecycleOwner\n\nadded in [version 1.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact android.arch.lifecycle:extensions:1.1.1 \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nProcessLifecycleOwner\n=====================\n\n| The `android.arch` Architecture Components packages are no longer maintained. They have been superseded by the corresponding [androidx.\\*](/jetpack/androidx/migrate) packages. See [androidx.lifecycle.ProcessLifecycleOwner](/reference/androidx/lifecycle/ProcessLifecycleOwner) instead.\n\n\n`\npublic\n\n\nclass\nProcessLifecycleOwner\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\nimplements\n\n`[LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner)`\n\n\n`\n\n|---|----------------------------------------------|\n| java.lang.Object ||\n| ↳ | android.arch.lifecycle.ProcessLifecycleOwner |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nClass that provides lifecycle for the whole application process.\n\n\nYou can consider this LifecycleOwner as the composite of all of your Activities, except that\n[ON_CREATE](/reference/android/arch/lifecycle/Lifecycle.Event#ON_CREATE) will be dispatched once and [ON_DESTROY](/reference/android/arch/lifecycle/Lifecycle.Event#ON_DESTROY)\nwill never be dispatched. Other lifecycle events will be dispatched with following rules:\nProcessLifecycleOwner will dispatch [ON_START](/reference/android/arch/lifecycle/Lifecycle.Event#ON_START),\n[ON_RESUME](/reference/android/arch/lifecycle/Lifecycle.Event#ON_RESUME) events, as a first activity moves through these events.\n[ON_PAUSE](/reference/android/arch/lifecycle/Lifecycle.Event#ON_PAUSE), [ON_STOP](/reference/android/arch/lifecycle/Lifecycle.Event#ON_STOP), events will be dispatched with\na **delay** after a last activity\npassed through them. This delay is long enough to guarantee that ProcessLifecycleOwner\nwon't send any events if activities are destroyed and recreated due to a\nconfiguration change.\n\n\nIt is useful for use cases where you would like to react on your app coming to the foreground or\ngoing to the background and you don't need a milliseconds accuracy in receiving lifecycle\nevents.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| ` static `[LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner) | ` `[get](/reference/android/arch/lifecycle/ProcessLifecycleOwner#get())`() ` The LifecycleOwner for the whole application process. |\n| ` `[Lifecycle](/reference/android/arch/lifecycle/Lifecycle) | ` `[getLifecycle](/reference/android/arch/lifecycle/ProcessLifecycleOwner#getLifecycle())`() ` Returns the Lifecycle of the provider. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n| From interface ` `[android.arch.lifecycle.LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner)` ` |----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Lifecycle](/reference/android/arch/lifecycle/Lifecycle) | ` `[getLifecycle](/reference/android/arch/lifecycle/LifecycleOwner#getLifecycle())`() ` Returns the Lifecycle of the provider. | ||\n\nPublic methods\n--------------\n\n### get\n\nadded in [version 1.1.0](/topic/libraries/support-library/revisions) \n\n```\nLifecycleOwner get ()\n```\n\nThe LifecycleOwner for the whole application process. Note that if your application\nhas multiple processes, this provider does not know about other processes.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| [LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner) | [LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner) for the whole application. \u003cbr /\u003e |\n\n### getLifecycle\n\nadded in [version 1.1.0](/topic/libraries/support-library/revisions) \n\n```\nLifecycle getLifecycle ()\n```\n\nReturns the Lifecycle of the provider.\n\n\u003cbr /\u003e\n\n| Returns ||\n|----------------------------------------------------------|---------------------------------------|\n| [Lifecycle](/reference/android/arch/lifecycle/Lifecycle) | The lifecycle of the provider. \u003cbr /\u003e |\n\n-\n\n Annotations\n -----------\n\n - [OnLifecycleEvent](/reference/android/arch/lifecycle/OnLifecycleEvent)\n-\n\n Interfaces\n ----------\n\n - [DefaultLifecycleObserver](/reference/android/arch/lifecycle/DefaultLifecycleObserver)\n - [LifecycleObserver](/reference/android/arch/lifecycle/LifecycleObserver)\n - [LifecycleOwner](/reference/android/arch/lifecycle/LifecycleOwner)\n - [LifecycleRegistryOwner](/reference/android/arch/lifecycle/LifecycleRegistryOwner)\n - [Observer](/reference/android/arch/lifecycle/Observer)\n - [ViewModelProvider.Factory](/reference/android/arch/lifecycle/ViewModelProvider.Factory)\n - [ViewModelStoreOwner](/reference/android/arch/lifecycle/ViewModelStoreOwner)\n-\n\n Classes\n -------\n\n - [AndroidViewModel](/reference/android/arch/lifecycle/AndroidViewModel)\n - [Lifecycle](/reference/android/arch/lifecycle/Lifecycle)\n - [LifecycleRegistry](/reference/android/arch/lifecycle/LifecycleRegistry)\n - [LifecycleService](/reference/android/arch/lifecycle/LifecycleService)\n - [LiveData](/reference/android/arch/lifecycle/LiveData)\n - [LiveDataReactiveStreams](/reference/android/arch/lifecycle/LiveDataReactiveStreams)\n - [MediatorLiveData](/reference/android/arch/lifecycle/MediatorLiveData)\n - [MutableLiveData](/reference/android/arch/lifecycle/MutableLiveData)\n - [ProcessLifecycleOwner](/reference/android/arch/lifecycle/ProcessLifecycleOwner)\n - [ServiceLifecycleDispatcher](/reference/android/arch/lifecycle/ServiceLifecycleDispatcher)\n - [Transformations](/reference/android/arch/lifecycle/Transformations)\n - [ViewModel](/reference/android/arch/lifecycle/ViewModel)\n - [ViewModelProvider](/reference/android/arch/lifecycle/ViewModelProvider)\n - [ViewModelProvider.AndroidViewModelFactory](/reference/android/arch/lifecycle/ViewModelProvider.AndroidViewModelFactory)\n - [ViewModelProvider.NewInstanceFactory](/reference/android/arch/lifecycle/ViewModelProvider.NewInstanceFactory)\n - [ViewModelProviders](/reference/android/arch/lifecycle/ViewModelProviders)\n - [ViewModelProviders.DefaultFactory](/reference/android/arch/lifecycle/ViewModelProviders.DefaultFactory)\n - [ViewModelStore](/reference/android/arch/lifecycle/ViewModelStore)\n - [ViewModelStores](/reference/android/arch/lifecycle/ViewModelStores)\n-\n\n Enums\n -----\n\n - [Lifecycle.Event](/reference/android/arch/lifecycle/Lifecycle.Event)\n - [Lifecycle.State](/reference/android/arch/lifecycle/Lifecycle.State)"]]