Skip to content
Android Foreground service written in Kotlin. It is a a non killable foreground service that runs continuously.
Kotlin
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea First commit Nov 11, 2019
app Fixes to notification scheduling. Nov 16, 2019
gradle/wrapper First commit Nov 11, 2019
.gitattributes Initial commit Nov 11, 2019
.gitignore Initial commit Nov 11, 2019
LICENSE Initial commit Nov 11, 2019
README.md Update README.md Nov 16, 2019
build.gradle Fixes to notification scheduling. Nov 16, 2019
gradle.properties First commit Nov 11, 2019
gradlew First commit Nov 11, 2019
gradlew.bat
settings.gradle First commit Nov 11, 2019

README.md

Foreground Service

A non killable foregroung service to run a task continously.

A foreground service is a service, which works exactly same as a normal service (background service) and the only difference is it has a notification attached to it in the notification tray of the device.

What is the use case of a foreground service in an Android application?

The main advantage of having a foreground service is its higher priority than its background version. Android OS implemented restriction to background execution to save battery and memory usages, i.e., it kills least used apps (or processes) to retain the memory and battery. To save battery it puts unused apps components into Doze mode and to save memory it kills background services to regain memory for its foreground apps.

There are many use cases in an Android app to have a foreground service. Main advantages the are followings,

  1. Higher priority hence less likely to be killed by OS
  2. Indication to user to inform about tasks under process.
  3. Accessibility to the app features like in music player apps.
You can’t perform that action at this time.