In some cases, apps won't stay in the background ("alive" or in a sleep mode) due to Android OS optimization function, or so called "battery save mode" — this function can kill background applications. It may be inconvenient to relaunch them each time they are getting closed. To avoid the background app termination you need to follow these steps which we described separately for each manufacturer (version) of Android OS. Note that instructions for different manufacturers are mostly very similar.
List of manufacturers with different versions of Android OS:
Information on Asus devices is still far from being exhaustive so there may be more issues than listed here. We're going to update this part of the article when we know more.
Go to Settings - Power Manager - Mobile Manager - Settings - Battery-saving options - Auto-start nanager - AdGuard - uncheck.
Go to Settings > Apps > Manage apps > AdGuard.
Now launch the active apps manager by swiping up from the bottom of the screen and look for the AdGuard app.
Tap and hold on it until a special menu pops up. Select a lock icon.
The lock icon should appear above the app window.
To let your app run successfully in the background, configure settings as follows:
Security > Battery > App Battery Saver > AdGuard > No restriction
To set up AdGuard's background work for Xiaomi devices you should pay attention to Battery and Permissions.
Go to "Battery"
Select "battery saver" app
Find and select AdGuard
Set up the following "Background settings":
Go to "Permissions"
Make sure that autostart function is enabled for AdGuard:
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.
Sleeping apps menu is the sniper’s nest for Samsung’s app killing policies. Make sure to follow the instructions very carefully to prevent the apps from being killed.
Note: Make sure that Put unused apps to sleep and Auto-disable unused apps is disabled. Otherwise Samsung will put your apps back to sleep after a few days (3 by default) even if you have woken them up manually!
For early Samsung devices, there is no huge need for setting up the background work, but if in your case the application is getting closed or disappears from the recent tasks after a while, do the following:
Tap on the Recent tasks button, tap on the Additional settings icon. It should look like this:
Tap on Lock Apps:
Also for reliable background processes you may need to uninstall PowerGenie as detailed below.
Note: On some phones with EMUI 9+ (Android P+) Huawei introduced a new task killer app called PowerGenie which forces to quit all apps not whitelisted by Huawei and does not give users any configuration options. See below how to uninstall it.
Huawei is extremely inventive in breaking apps on their devices. In addition to all the non-standard power management measures described below, they introduced a new task killer app build right into EMUI 9 on Android Pie.
It is called PowerGenie and it kills all apps that are not on its whitelist. You cannot add custom apps on their pre-defined whitelist. This means there is no other way to fix proper app functionality on Huawei than uninstalling PowerGenie.
Unfortunately, this is a system app that can only be fully uninstalled using ADB (Android Debug Bridge) Source: XDA.
You need to:
1) Install ADB on your computer;
2) Connect your phone with a data cable;
3) Enable Developer options;
4) Enable USB debugging within Developer options on your phone;
5) Run the following commands on your computer:
adb shell pm uninstall --user 0 com.huawei.powergenie
We did not yet have this confirmed but it is possible you can alternatively just disable PowerGenie in Phone settings > Apps. This setting would need to be re-applied every time you reboot your device.
Please still follow the steps below - Huawei phones usually have multiple powersaving mechanisms.
Also, you may not have PowerGenie on your phone, but your apps may still get killed by another mechanism.
[uncheck]and Keep running after screen off
Open device settings > Apps > Settings > Special access > choose Ignore battery optimization > select Allow for your app.
Open device settings > Battery > App launch > then set your app to Manage manually and make sure everything is turned on.
Phone settings > Battery > App launch and then set your app to “Manage manually” and make sure everything is turned on. Also for reliable background processes you may need to uninstall PowerGenie as described above.
Old Huawei devices are the easiest to set up, it is enough to perform two simple steps to lock the application in the background so it won't be terminated by battery saving or background killer process.
Tap on the Recent tasks button:
Tap on the lock icon:
Besides, to set up the background work of your app more effectively, you should open device settings and do the following:
Meizu has almost the same approach to the background process limitations as Huawei and Xiaomi. So you can avoid disabling the background work of AdGuard and any other app by adjusting the following settings:
Nokia on Android O and P disables any background process after 20 minutes if the screen is off.
Here is what you need to do in order to prevent killing the background process of your app:
From now on, background apps are supposed to work smoothly and use the standard Android battery optimizations.
There is an alternative solution for background work optimization which is more appropriate for advanced users. You will find the instructions below.
pm uninstall --user 0 com.evenwell.emm
pm uninstall --user 0 com.evenwell.powersaving.g3
Sometimes 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:
Go to “Security Centre” - tap on "Privacy Permissions" - "Startup manager" and allow AdGuard app to run in background.
Devices with OxygenOS on board are the most problematic, with its OS-sepcific cache cleaning and free RAM, including OS optimization. In addition, OxygenOS can interrupt the application's work if you do not use it for a while. To avoid these unwanted consequences, follow these steps:
Go to Settings
Battery - Battery optimization
Find the app you want to keep awake all the time
Tap on it and select "Don't optimize" option
Tap "Done" to save
Open recent apps menu (as showed on this screenshot):
On some OnePlus phones there is also a thing called App Auto-Launch and Deep Optimisation which essentially prevents apps from working in the background. Please disable it for your app.
And here is one more thing to try:
Open device settings > Battery > Battery optimization > switch to the All apps list (top menu) > choose your app > activate Don’t optimize
Open device settings > Battery > Battery Optimisation > three dots > Advanced Optimisation > Disable Deep Optimisation
Sony was the first mobile OS developer to introduce non-standard background process optimization and opened Pandora’s box. It is called Stamina mode and it instantly breaks all background processes and all alarms if enabled.
Go to Settings - Battery - Three dots in the top right corner - Battery optimisation - Apps - AdGuard - uncheck
Wiko devices are definitely problematic in terms of non-standard background process optimizations and adjustments to the settings that need to be done to make apps work properly.
Android stock OS normally does not conflict with applications working in the background, but if you are facing any issues you will need to switch on the "Always on VPN" mode.
Go to Settings - Network and Internet
Tap on "VPN" and choose AdGuard
Set up "Always on VPN" mode