First understand about Android services: Three different types of services:
1. Foreground service: is a service that stays alive even when the app
is terminated. Foreground services continue running even when the
user isn't interacting with the app.
List of Apps:
- Music player app that plays music in a foreground service
- Fitness app that records a user's run in a foreground service
- Navigation app, allows users to get turn-by-turn directions
- Even you perform your download
Note: To download and the process in the background Google recommend you to use WorkManager.
Let's understand background work:
An app is running in the background when both the following
conditions are satisfied:
- None of the app's activities are currently visible to the user.
- The app isn't running any foreground services that started while an
activity from the app was visible to the user.
2. Background service: is a service that runs only when the app is running so it’ll get terminated when the app is terminated. It performs an operation that isn't directly noticed by the user.
List of Apps:
- Downlead data from server
- Continuously share location
- Sync data with server also use workmanager
- IOT Apps
3. Bound service: is a service that runs only if the component it is bound to is still active. A bound service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed.
- All above apps can be bounded or not