Android & Jetpack Compose (50 Qs)•Part 2: Compose Internals, Persistence, DI & Background Work (11 - 24)
What are Android Services (Foreground, Background, Bound)?
senior LevelDocker & Containers
In Simple Words: A Service is an application component that performs long-running operations in the background without a UI:
- Foreground Service: Performs operations noticeable to the user (e.g. music playback, GPS navigation, active file download). Must display a non-dismissible notification in the system tray.
- Background Service: Restricted heavily in modern Android (Android 8+ kills background services after minutes to preserve battery; use WorkManager instead).
- Bound Service: Acts as a client-server interface, allowing Activities to bind via IPC and interact with the service.