From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

Manage deferrable tasks with WorkManager

Manage deferrable tasks with WorkManager

- [Narrator] Android's WorkManager architecture is designed to handle deferrable, long-running tasks. When you set up a task, it's guaranteed to run whenever the constraints you defined are satisfied. So for example you could say, "Only do this work "when the network is available." Or, "Only do this when the device isn't dozing." If a task is interrupted for any reason, the WorkMangager process can try the task again. WorkManager can be used back to API 14, or Android 4. On recent versions of Android, a WorkManager task is executed through the JobScheduler API, and on older versions it runs with a combination of BroadcastReceiver and AlarmManager. But you don't need to learn those other APIs to use WorkManager. You define what you want WorkManager to do and then it will decide how to get it done. To use WorkManager, you'll need to add some new information to your Gradle build file. First you'll need a new dependency. I'll…

Contents