Search code examples
androiddeprecatedandroidxandroid-architecture-componentsandroid-architecture-lifecycle

Is LifecycleService deprecated along with lifecycle-extensions artifact?


It seems the LifecycleService class that used to live in the lifecycle-extensions artifact is not available in any of the current recommended artifacts. I'd expect it to be in lifecycle-runtime, which is the one without ViewModel andLiveData, but LifecycleService is not in lifecycle-viewmodel or lifecycle-livedata.

Has LifecycleService been deprecated?

Source on current Lifecycle artifacts


Solution

  • No, LifecycleService is in the lifecycle-service dependency as per the Lifecycle 2.2.0 release notes:

    lifecycle-extensions Artifact Deprecation: With the above deprecation of ViewModelProviders.of(), this release marks the deprecation of the last API in lifecycle-extensions and this artifact should now be considered deprecated in its entirety. We strongly recommend depending on the specific Lifecycle artifacts you need (such as lifecycle-service if you’re using LifecycleService and lifecycle-process if you’re using ProcessLifecycleOwner) rather than lifecycle-extensions as there will not be a future 2.3.0 release of lifecycle-extensions.