Background tasks
Background tasks (or background processing) are any task that executes outside Main Thread, i.e., executes on a background thread. Any task that takes more than a few milliseconds should be delegated to a background thread.
Background tasks fall into one of the following main categories:
Background tasks fall into one of the following main categories:
- Immediate: task need to complete while the user is interacting with the application.
- Deferred: task allow for slight variations in when it run that are based on conditions such as network availability and remaining battery.
- Exact: task need to run at an exact time.
- Immediate tasks -> Kotlin coroutines.
- Deferred tasks -> WorkManager.
- Exact tasks -> AlarmManager (*).