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.
- 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 battery
- Schedule asynchronous one-off or periodic tasks
- Monitor and manage scheduled tasks
- Chain tasks together
- Guarantees task execution, even if the app or device restarts
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 be 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.
Check out the release notes to learn how to import WorkManager into your Android project.
- WorkManager basics
- Use WorkManager to schedule single tasks that run under the circumstances you choose, or tasks that must run periodically.
- WorkManager advanced features
- Set up chained sequences of tasks, set up tasks that pass and return values, and set up named, unique work sequences.
- Migrating from Firebase JobDispatcher
- Update an existing app so it uses WorkManager instead of Firebase JobDispatcher.
- WorkManagerSample, a simple image-processing app
- Sunflower, a demo app demonstrating best practices with various architecture components, including WorkManager.
- Working with WorkManager, from the 2018 Android Dev Summit