WorkManager
Hardly a year goes by anymore without some new solution for doing background work becoming available for Android developers. In some cases, the new solution is designed to make things easier. In some cases, the new solution is designed to work around platform-imposed limitations (a.k.a., “The War on Background Processing”).
The solution introduced in 2018 was WorkManager
, and preliminary indications are that it will be Google’s “go-to” solution for many background work scenarios.
WorkManager
is considered to be part of the Architecture Components, despite having only loose connections to the rest of the Components. WorkManager
does offer ways to monitor work via LiveData
, for cases where the work happens to be going on while your UI is still visible.
In this chapter, we will explore WorkManager
, its role, and how to employ it.
NOTE: At the time of this writing, WorkManager
is in a beta state.
Where Should We Use WorkManager
?
WorkManager
is designed for “deferrable” work — work that you need to have done but does not have to happen right away. This includes the possibility that the work will be done sometime after your current process has terminated.
In this respect, WorkManager
behaves akin to JobScheduler
, which is the main engine behind WorkManager
for API Level 23+ devices.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.