All tips are from https://dontkillmyapp.com/ At first start the accessibility service for LED Blinker.
EMUI 6+ devices (and some EMUI 5 devices)
- Phone settings > Advanced Settings > Battery manager > Power plan is set to Performance
- Phone Settings > Advanced Settings > Battery Manager > Protected apps – check for your app as Protected
- Phone Settings > Apps > Your app > Battery > Power-intensive prompt [x] and Keep running after screen off [x]
- Phone settings > Apps > Advanced (At the bottom) > Ignore optimisations > Press Allowed > All apps >Find your app on the list and set to Allow
Huawei P9 Plus
- Phone settings > Apps > Settings > Special access > Ignore battery optimisation > select allow for your app.
- Phone settings > Battery > App launch and then set your app to “Manage manually” and make sure everything is turned on.
Huawei Honor 9 Lite, Huawei Mate 9 Pro
- Phone settings > Battery > Launch and then set your app to “Manage manually” and make sure everything is turned on. On EMUI 4 there is no way out, sorry, but you can ask developers of your apps to implement the workaround described in Developer section
Turn off System Settings > Apps > Gear Icon > Special Access > Battery Optimization.
WARNING: Recently OnePlus phones started reverting this setting randomly for random apps. So if you set it to be not optimized, the next day it may be back to optimized. There is no workaround and you may have to check system settings every once in a while. See a bug report filed to OnePlus. To avoid the system to automatically revert the not optimized setting, you must also lock the app into the ‘Recent App’ list. (solution described here) Start the app you want to ‘Protect’. Press the phone Recent app button. Toggle the Lock button on the upper right corner of the app. This will avoid the app to be killed in background and the Battery optimisationsetting to be reverted.
On some OnePlus phones there is also a thing called App Auto-Launch which essentially prevents apps from working in the background. Please disable it for your app.
Also try: Phone settings > Battery > Battery optimization and switch to the All apps list (Top menu) > Your app > Don’t optimize
NOTE: Some of our users indicated that you need to disable Doze mode in Developer options in 1+3 and earlier. Also disable Settings > Battery > Battery optimization > (three dots) > Enhanced optimization. This option may also be called Advanced optimisation.
Recent app clear behaviour manager is also a likely culprit:
Galaxy S9 / S10
Battery optimization is turned on by default. At some unclear moments (maybe on app update, OS update?), the settings also do revert back to the defaults, forcing you to turn them off again and again. Below are walkthrough screenshots for Galaxy S10. Please let us know your feedback about whether it works for S9 (or others) as well. Thanks!
Galaxy S8 (j6ltedx) and later
With the introduction of their flagship Galaxy S8 (and with some earlier experiments), Samsung has introduced a flawed attempt at prolonging battery life called App power monitor. For your apps to work correctly, please whitelist them in App power monitor. How to do it: Open the Settings > Device maintenance > Battery and at the bottom you’ll see a list of your most frequently used apps. You can manage apps individually or in a group by selecting them then tapping the big Save power button. Apps that are sleeping will appear in the Sleeping apps list at the bottom (tap it to expand the list). Scrolling further — all the way to the very bottom — and you’ll find Unmonitored apps. These are apps that you specifically want to exclude (white list) from App power monitor evil reach. When inside the Unmonitored apps menu, you can tap the 3-dot menu to add or delete apps from the list. Rather than bothering with any of that, you can just turn off the App power monitor feature completely as it has little-to-no impact on battery life and only serves to handicap the normal functioning of your Galaxy phone. It’s excessive and in some cases downright misleading, using scare tactics to keep you reliant on Samsung’s software when other Android devices get by just fine without it.
On other Samsung phones, the path may look like this:
Phone settings > Applications > select three dot menu (top right corner) > Special Access > Optimize Battery usage > Find your app on the list and make sure that it is not selected.
NOTE: If you enable Edge Lighting for your app, then the app will not be able to wake up your screen. To allow your app to wake up your screen, please remove it from the Edge Lighting applications list.
Sony gets a high rank in our listing of toxic Android vendors as historically it was Sony who introduced the first very effective non-standard background process optimization and opened the Pandora’s box. It is called Stamina mode and it instantly breaks all background processes and all alarms if enabled.
Solution for users
FeedbackNever use Stamina mode if you want your phone to do something useful when you are not actively using it. Try to make your app not battery optimized in Phone settings > Battery > Three dots in the top right corner > Battery optimisation > Apps > your app.
Background services are being killed (including accessibility services, which then need re-enabling) every time you turn the screen off. So far, a workaround for this is:
- pin your app to the recent apps screen
- enable your app in the app list inside the security app’s “startup manager” and “floating app list” (com.coloros.safecenter / com.coloros.safecenter.permission.Permission)
- turn off battery optimizations
- give the service a persistent notification to remain in the foreground