androidx.work

WorkManager is a library used to enqueue deferrable work that is guaranteed to execute sometime
after its Constraints are met. WorkManager allows observation of work
status and the ability to create complex chains of work.

WorkManager uses an underlying job dispatching service when available based on the following
criteria:

All work must be done in a ListenableWorker class. A simple
implementation, Worker, is recommended as the starting point for most
developers. With the optional dependencies, you can also use CoroutineWorker or
RxWorker. All background work is given a maximum of ten minutes to finish its execution.
After this time has expired, the worker will be signalled to stop.

There are two types of work supported by WorkManager: OneTimeWorkRequest
and PeriodicWorkRequest. OneTimeWorkRequests can be chained together into
acyclic graphs. Work is eligible for execution when all of its prerequisites are complete.
If any of its prerequisites fail or are cancelled, the work will never run.

WorkRequests can accept Constraints, inputs (see
Data), and backoff criteria. WorkRequests can be tagged with
human-readable Strings (see addTag(String)), and
chains of work can be given a uniquely-identifiable name with conflict policies. *

WorkManager BroadcastReceivers to monitor Constraints on devices
before API 23. The BroadcastReceivers are disabled on API 23 and up. In particular, WorkManager
listens to the following Intents:

android.intent.action.ACTION_POWER_CONNECTED

android.intent.action.ACTION_POWER_DISCONNECTED

android.intent.action.BATTERY_OKAY

android.intent.action.BATTERY_LOW

android.intent.action.DEVICE_STORAGE_LOW

android.intent.action.DEVICE_STORAGE_OK

android.net.conn.CONNECTIVITY_CHANGE

*

In addition, WorkManager listens to system time changes and reboots to properly reschedule work
in certain situations. For this, it listens to the following Intents:

android.intent.action.BOOT_COMPLETED

android.intent.action.TIME_SET

android.intent.action.TIMEZONE_CHANGED

WorkManager uses the following permissions:

android.permission.WAKE_LOCK to make it can keep the device awake to complete
work before API 23

android.permission.ACCESS_NETWORK_STATE to listen to network changes before API
23 and monitor network Constraints

android.permission.RECEIVE_BOOT_COMPLETED to listen to reboots and reschedule
work properly.

Note that WorkManager may enable or disable some of its BroadcastReceivers at runtime as needed.
This has the side-effect of the system sending ACTION_PACKAGE_CHANGED broadcasts to your
app. Please be aware of this use case and architect your app appropriately (especially if you
are using widgets - see https://issuetracker.google.com/115575872).