Getting started with WorkManager explains that WorkManager performs background work asynchronously on your behalf. The basic implementation addresses the demands of most apps. For more advanced use cases, such as correctly handling work being stopped, you should learn about threading and concurrency in WorkManager.
There are four different types of work primitives provided by WorkManager:
Workeris the basic implementation, and the one you have seen in previous sections. WorkManager automatically runs it on a background thread, which you can override. For more information about threading inWorkerinstances, see Threading in Worker.CoroutineWorkeris the recommended implementation for Kotlin users.CoroutineWorkerinstances expose a suspending function for background work. By default, they run a defaultDispatcher, which you can customize. For more information about threading inCoroutineWorkerinstances, see Threading in CoroutineWorker.RxWorkeris the recommended implementation for RxJava users. UseRxWorkerif a lot of your existing asynchronous code is modeled in RxJava. As with all RxJava concepts, you are free to choose the threading strategy. For more information about threading inRxWorkerinstances, see Threading in RxWorker.ListenableWorkeris the base class forWorker,CoroutineWorker, andRxWorker. It is intended for Java developers who have to interact with callback-based asynchronous APIs such asFusedLocationProviderClientand are not using RxJava. For more information about threading inListenableWorkerinstances, see Threading in ListenableWorker.