androidx.lifecycle:lifecycle-process
Official Description: Android Lifecycle Process
CommonsWare’s Notes
This artifact contains ProcessLifecycleOwner
. This is Google’s official solution
for the age-old question, “how do I know when my app has moved to the background?”
In a nutshell, ProcessLifecycleOwner
watches for activities coming and going,
and it considers your app to be “stopped” overall if you have no foreground
activities for at least 700ms. Since ProcessLifecycleOwner
is a LifecycleOwner
,
you can observe “lifecycle” events for your whole app using the same sorts
of low-level tools that you can use for observing activity and fragment
lifecycles.
Note that adding this artifact to your project will add a ContentProvider
,
supplied by the artifact, to your manifest.
Also, as with lots of pieces of the Jetpack, ProcessLifecycleOwner
pre-dates
AndroidX. You will see references to android.arch.lifecycle.ProcessLifecycleOwner
,
which has been replaced by androidx.lifecycle.ProcessLifecycleOwner
.
The primary API has not changed, though.
Documentation
Knowledge
- Android ProcessLifecycleOwner by example (2019-08-20)
- React to foreground and background events with ProcessLifecycleOwner (2017-10-14)
Versions
- Latest Stable: 2.3.0
- Latest Release Candidate: 2.3.0-rc01
- Latest Beta: 2.3.0-beta01
- Latest Alpha: 2.3.0-alpha07
- 2.3.0
- 2.3.0-rc01
- 2.3.0-beta01
- 2.3.0-alpha07
- 2.3.0-alpha06
- 2.3.0-alpha05
- 2.3.0-alpha04
- 2.3.0-alpha03
- 2.3.0-alpha02
- 2.3.0-alpha01
- 2.2.0
- 2.2.0-rc03
- 2.2.0-rc02
- 2.2.0-rc01
- 2.2.0-beta01
- 2.2.0-alpha05
- 2.2.0-alpha04
- 2.2.0-alpha03
- 2.2.0-alpha02
- 2.2.0-alpha01
- 2.1.0
- 2.1.0-rc01
- 2.1.0-beta01
- 2.1.0-alpha04
- 2.1.0-alpha03
- 2.1.0-alpha02
- 2.1.0-alpha01
- 2.0.0
- 2.0.0-rc01
- 2.0.0-beta01
- 2.0.0-alpha1