Hey Android, Don't Kill My App!
Many Android devices include a "Smart Manager" or "Battery Optimizer" which kills background-running apps like mileage trackers and alarm clocks. What can you do to circumvent this?
As the Android operating system evolves, more and more restrictions are put in place to limit background execution of apps, in order to reduce power consumption and extend the battery life between charges. While this is generally useful, it may break the operation of apps that depend on background execution, such as alarm clocks, health trackers, mileage trackers, or simply anything that needs to do some job for you at a particular moment when you aren’t using your device.
Android is an open source operating system for mobile devices. Each device manufacturer (OEM) can therefore modify the system and release its own flavour of Android. Many OEMs choose to increase the restrictions on background running processes, or include additional features such as "Smart Manager" or "Battery Optimizer". These features are enabled by default and restrict all apps from running for extended periods (or at all) in the background.
The website DontKillMyApp includes a rather extensive list of the worst offenders. If you encounter issues with background-running apps, check the information relevant to your Android device on this website, and follow the suggested solutions.
DontKillMyApp offers an Android app by the same name. We recommend installing this app and running the benchmark test for at least 1 hour. The result of the test is a percentage indicating the success rate of background operation. The lower the percentage value, the more restrictive your Android system is. In other words, higher values (ideally 100%), will result in better performance of background-running apps, like mileage trackers and alarm clocks.
If the benchmark test results for your device are very low (below 50%), you should examine your Android Settings again and disable any battery saving or power management feature, then re-run the benchmark tests. To assist you in the process, we've created this FAQ entry. If you've already disabled power management and are still seeing no improvement, there may be an issue with the specific Android version provided by your OEM. Check if your OEM offers a system patch or update, or contact their technical support.
As an example, we've taken some screenshots on a Samsung-A50 device running Android 11 (SDK 30) and using Psngr Mileage Tracker. Psngr app logs your trips automatically. In order to detect when you start and stop moving, the app sets a foreground service, which runs in the background and collects data from bluetooth, WiFi, and physical activity sensors on your device. Without the ability to run in the background, Psngr app cannot detect your movement properly and log your trips.
In the example below we review the Android Settings you should enable or disable in order to ensure that Psngr app can run in the background, without being killed by the system.
Check Permissions:
Android Settings > Apps > Psngr > Permissions
- Ensure that all permissions are under ALLOWED.
- "Location" permission must be "Allow all the time".
- "Remove permissions if app isn't used" must be OFF.
Allow Background Activity
Android Settings > Apps > Psngr > Battery
- "Allow background activity" must be ON
- "Optimize battery usage" must be OFF
Allow Mobile Data
Android Settings > Apps > Psngr > Mobile data
- "Allow background data usage" must be ON
Disable Power Saving
Android Settings > Battery and device care > Battery
- "Power saving mode" must be OFF
- Background usage limits > Put unused apps to sleep > OFF
If you are using a Samsung device, it's possible that the menus and screens on your device will differ slightly from the above, depending on the specific device model and the Android version. It's also been known that Samsung resets some of the settings above after a firmware update.
For more info about configuring your Samsung device to allow background execution of apps, see dontkillmyapp.com/samsung.
If you are using an Android device from a different brand / manufacturer, check dontkillmyapp.com for your specific brand and model.