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

Versions