Schedule tasks with WorkManager Part of Android Jetpack.
The WorkManager API makes it easy to schedule deferrable, asynchronous tasks that are expected to run even if the app exits or device restarts.
Key features:
- Backwards compatible up to API 14
- Uses JobScheduler on devices with API 23+
- Uses a combination of BroadcastReceiver + AlarmManager on devices with API 14-22
- Add work constraints like network availability or charging status
- Schedule asynchronous one-off or periodic tasks
- Monitor and manage scheduled tasks
- Chain tasks together
- Ensures task execution, even if the app or device restarts
- Adheres to power-saving features like Doze mode
WorkManager is intended for tasks that are deferrable—that is, not required to run immediately—and required to run reliably even if the app exits or the device restarts. For example:
- Sending logs or analytics to backend services
- Periodically syncing application data with a server
WorkManager is not intended for in-process background work that can safely be terminated if the app process goes away or for tasks that require immediate execution. Please review the background processing guide to see which solution meets your needs.
To import the WorkManager library into your Android project, add the following
dependencies to your app's build.gradle file:
dependencies {
def work_version = "2.3.4"
// (Java only)
implementation "androidx.work:work-runtime:$work_version"
// Kotlin + coroutines
implementation "androidx.work:work-runtime-ktx:$work_version"
// optional - RxJava2 support
implementation "androidx.work:work-rxjava2:$work_version"
// optional - GCMNetworkManager support
implementation "androidx.work:work-gcm:$work_version"
// optional - Test helpers
androidTestImplementation "androidx.work:work-testing:$work_version"
}
Topics
Basics
How-to guides
- Defining your WorkRequests
- Observing the status of your work
- Observing intermediate Worker progress
- Chaining work together
- Cancelling and stopping work
- Handling recurring work
- Handling unique work
- Testing your Workers
- Debugging
Advanced concepts
Migration guides
Additional resources
Samples
- WorkManagerSample, a simple image-processing app
- Sunflower, a demo app demonstrating best practices with various architecture components, including WorkManager.
Codelabs
- Working with WorkManager (Kotlin) and (Java)
- Advanced WorkManager (Kotlin)
Videos
- Working with WorkManager, from the 2018 Android Dev Summit
- WorkManager: Beyond the basics, from the 2019 Android Dev Summit

