Mobile apps

What is an Android foreground service?

A foreground service is a long-running Android task that the user knows about because it shows a persistent notification. It lets work such as navigation, recording, uploads or live location tracking continue while the app is not open.

Why the notification exists

Android restricts hidden background work to save battery and protect privacy. In exchange for a visible notification, the system keeps the service alive and gives it more freedom.

Rules to know

Recent Android versions require each foreground service to declare a type, such as location, microphone or data sync, along with the matching permission. Starting one from the background is restricted, and Google Play asks you to justify sensitive types in a declaration form. Location types need clear user-facing reasons.

Good practice

  • Use it only for work the user started or expects.
  • Stop the service as soon as the task ends.
  • Write notification text that says what is happening.
  • Handle the phone restarting mid-task.

A driver app that shares live position during a shift is a typical case. Anything that could be a scheduled job should use WorkManager instead.

Questions, answered

No. The notification is the requirement. Users can mute the channel but not remove the service's visibility.

The declared type or demo video did not match what the app actually does.

By the Stegnor team · Updated