fbpx

There are three things that are certain in life: death, taxes, and Google restricting background work. With every new Android release, Google seemingly further restricts what apps running in the background can do. This is understandable because battery power is a finite commodity on Android phones, so allowing apps to do whatever they want whenever they want would be detrimental to battery life. To prevent rogue applications from draining your phone’s battery, the Android OS implements a number of battery management tactics to control when apps can run and how long they can run.

Apps that need to perform critical, real-time tasks like downloading a file, tracking a run, or playing music can create a foreground service, but in order to do so, they must show a notification so users are aware. Instead of creating a foreground service, Google recommends most developers use APIs like JobScheduler and AlarmManager (or a higher-level wrapper, like WorkManager) to queue tasks in the background.