How to protect AdGuard from being disabled by the system
This article is about AdGuard for Android, a multifunctional ad blocker that protects your device at the system level. To see how it works, download the AdGuard app
In some cases, apps won't stay in the background (“alive” or in a sleep mode) due to the Android OS optimization function, or the so-called “battery save mode” — this function can kill background apps. It may be inconvenient to relaunch them each time they are getting closed. To avoid the background app termination, you need to follow the steps we described separately for each manufacturer (version) of Android OS. Note that instructions for different manufacturers are mostly very similar.
Asus
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.
The main source of potential problems with background work on Asus devices is associated with the optimization app called Power Master. It is pre-installed and has pretty aggressive default settings, e.g. to block apps from starting and to kill background tasks when your screen turns off. To make sure apps background processing works, set up the following:
Go to Mobile Manager → PowerMaster → Settings (or Battery-saving options) → Uncheck Clean up in suspend
Go to Mobile Manager → PowerMaster → Settings (or Battery-saving options) → Uncheck Auto-deny apps from auto starting
Alternatively, instead of unchecking Auto-deny apps from auto starting entirely, you can go to Settings → Battery-saving options → Auto-start manager → AdGuard and uncheck it.
Xiaomi
Xiaomi (and especially MIUI) devices are among the most troublesome ones when it comes to background work. They are known to limit background processes and have non-standard permissions with a lack of proper documentation to top it off. Sometimes apps just don't work right on Xiaomi phones and there's little that can be done about that. Below are some actions you might attempt to perform if you run into any trouble regarding AdGuard's background work on various Xiaomi devices.
MIUI 13+ and HyperOS
Depending on the MIUI and HyperOS versions, there are two ways to change the battery optimization settings on your phone and block ads more efficiently.
Option 1
Go to Settings → Apps → Permissions → Background autostart and allow AdGuard to run in the background
Return to Settings → Apps → Manage apps → AdGuard and uncheck Pause app activity if unused
Go to Battery saver and tap No restrictions
Option 2
Go to Settings → Apps → Manage apps → AdGuard and enable Autostart
Go to Battery saver and tap No restrictions
Done! You have successfully set up AdGuard to work in the background.
MIUI 12.0.8
To let your AdGuard app run successfully in the background, do the following:
In Settings → Apps → Manage apps, scroll down to locate AdGuard and set Autostart to “On”.
Scroll down to Battery saver, tap it, and set to “No restrictions”.
In Other Permissions, set all possible permissions to “On”
Run the Security app.
Tap on the Gear icon at the top-right corner of the screen.
Tap Boost speed in Feature Settings.
Tap Lock apps.
In the Lock apps screen, set the toggle switch for the AdGuard app to On.
That’s all! You’ve successfully pinned the AdGuard app.
MIUI 12
Go to Settings → Apps → Manage apps → AdGuard.
- Set Autostart to “On”
- Set all possible permissions in Other Permissions to “On”
- Set Battery saver to No restrictions
Now launch the active apps manager by swiping up from the bottom of the screen and look for the AdGuard app.
Tap and hold it until a menu pops up. Select a lock icon.
The lock icon should appear above the app window.
MIUI 10-11
To let your app run successfully in the background, configure its settings as follows:
- Set Autostart to “On”
- Settings → Battery & performance → switch-off Battery saver function
- Then open App battery saver settings → AdGuard → No restrictions
All models
The following steps should be performed on any Xiaomi device that keeps killing the AdGuard app:
Power management
Please enable:
- Settings → Advanced Settings → Battery manager → set Power plan to Performance
- Device Settings → Advanced Settings → Battery Manager → Protected apps — AdGuard needs to be Protected
- Device Settings → Apps → AdGuard → Battery → Power-intensive prompt and Keep running after screen off
- Settings → Additional Settings → Battery & Performance → Manage apps’ battery usage and here:
- Switch Power Saving Modes to “Off”
- Choose the following options: Saving Power in The Background → Choose apps → AdGuard → Background Settings → No restrictions
App battery saver
Set Security → Battery → App Battery Saver → AdGuard to No restriction
App pinning
To set up AdGuard's background work for Xiaomi devices you should pay attention to Battery and Permissions.
Tap the Recent tasks button and swipe AdGuard down to make options visible (as shown on the screenshot):
Tap on the lock icon. This will stop Xiaomi from closing AdGuard automatically. It should look like this:
Go to Battery
Select the battery saver app
Find and select AdGuard
Set up the following Background settings:
Go to Permissions
Select Autostart
Make sure that autostart function is enabled for AdGuard:
Samsung
On many Samsung devices, any app that is unused for 3 days will not be able to start from background. You should turn off Adaptive battery and Put apps to sleep options wherever possible to prevent that. Note that after an app or OS update, these settings often revert to their default values and will need to be turned off again.
Android 11+
On Android 11, Samsung will prevent apps (including AdGuard) from working in background by default unless you exclude them from battery optimizations. To make sure AdGuard will not get killed in the background:
Lock AdGuard in Recent
- Open Recent apps.
- Find AdGuard.
- Long-press the icon of the AdGuard app.
To keep AdGuard working properly:
Go to Settings → Apps → AdGuard → Battery → Optimize battery usage
In the drop-down menu, select All. Then find AdGuard on the list and set the state for it to Don’t optimize (on some models, there may be a switch that you need to toggle off).
On some devices, the relevant setting may be named differently and be located in other places. Among the possible paths is:
Settings → Apps → (⁝) menu → Special Access → Optimize battery usage → Find AdGuard on the list and uncheck it
Disable automatic optimization. To do so:
Open Battery → (⁝) menu → Choose Automation → Toggle off all of the settings there
Again, the exact path may differ, for example on some devices you should go to:
Phone Settings → Device care → Tap the (⁝) 3-dot menu → Advanced → Disable Auto optimization and Optimize settings
If your phone has it, disable Adaptive battery:
Open phone Settings → Battery → More battery settings → Toggle off Adaptive battery
Disable Sleeping apps (the exact name of this setting and the path to it may vary depending on the device):
Open phone Settings → Battery → Background usage limits → Disable Put unused apps to sleep
Android 9 & 10
Go to Phone settings → Device care → Tap on the Battery item → (⁝) 3-dot menu → Settings and uncheck Put unused apps to sleep and Auto-disable unused apps.
Check that Phone settings → Apps → Sleep as Android → Battery → Background restriction is set to App can use battery in background for AdGuard.
Remove AdGuard from Sleeping apps. To do that:
Go to Phone settings → Device care
Tap Battery
Tap the 3-dot menu → Settings
Tap Sleeping apps
Wake up AdGuard using the trashcan icon
Old Samsung devices
For early Samsung devices, there is no huge need for setting up the background operation, but if in your case the AdGuard app is getting closed or disappears from the recent tasks after a while, do the following:
Tap the Recent tasks button, tap the Additional settings icon. It should look like this:
Tap Lock Apps:
Tap on the lock icon
Huawei
Huawei and their Android customization EMUI belongs to the most troublesome on the market with respect to non-standard background process limitations. On default settings, virtually all apps that work in background will face problems and ultimately break.
App Launch on some EMUI 8, 9 and 10 devices (Huawei P20, Huawei P20 Lite, Huawei Mate 10…)
This feature may or may not be available for all devices or may be labeled differently.
Go to phone Settings → Battery → App launch
Turn off Manage all automatically
Set AdGuard to Manage manually and enable all toggles.
Disable Startup manager that prevents apps from running automatically after the phone starts up.
Go to Settings → All → Startup manager → Toggle AdGuard off
Also for reliable background processes you may need to uninstall PowerGenie as detailed below.
EMUI 9+ devices and PowerGenie
On phones with EMUI 9+ (Android P+) there is a 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 task killer app built 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 achieve 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).
You need to:
It is not confirmed, but it might be possible to just disable PowerGenie in Phone settings → Apps. If this setting is present in your device's settings, you may skip the following steps. However, it would need to be re-applied every time you reboot your device. If there is no such setting, follow this instruction:
Install ADB on your computer;
Connect your phone with a data cable;
Enable Developer options;
Enable USB debugging within Developer options on your phone;
Run the following commands on your computer:
adb shell pm uninstall --user 0 com.huawei.powergenie
adb shell pm uninstall -k --user 0 com.huawei.android.hwaps
If AdGuard keeps getting killed, also try running
adb shell pm stopservice hwPfwService
EMUI 6+ devices (and some EMUI 5 devices)
- Phone settings → Advanced Settings → Battery manager → Power plan set to Performance;
- Phone Settings → Advanced Settings → Battery Manager → Protected apps — set AdGuard as Protected;
- Phone Settings → Apps → Your app → Battery → Power-intensive prompt
[uncheck]
and Keep running after screen off[check]
; - Phone settings → Apps → Advanced (At the bottom) → Ignore optimizations → Press Allowed → All apps → Find AdGuard on the list and set to Allow.
Huawei P9 Plus
Open device settings → Apps → Settings → Special access → choose Ignore battery optimization → select Allow for AdGuard.
Huawei P20, Huawei Honor 9 Lite and Huawei Mate 9 Pro
Open device settings → Battery → App launch → set AdGuard to Manage manually and make sure everything is turned on.
Huawei P20, Huawei P20 Lite, Huawei Mate 10
Phone settings → Battery → App launch → set AdGuard to Manage manually and make sure everything is turned on. Also for reliable background processes you may need to uninstall PowerGenie as described above.
Early Huawei
Old Huawei devices are the easiest to set up, it is enough to perform two simple steps to lock AdGuard in the background so it won't be terminated by battery saving or background killer process.
Tap the Recent tasks button:
Tap on the lock icon:
Besides, to set up the background work of AdGuard more effectively, you should open device settings and do the following:
- Go to Settings → open Battery Manager → set Power plan to Performance;
- Then choose Protected apps in the Battery Manager and check if AdGuard is Protected;
- Go to Apps in the main settings and tap AdGuard there → choose Battery → enable Power-intensive prompt and Keep running after screen is off;
- Then in the Apps section open Settings (at the bottom) → Special access → choose Ignore battery optimization → press Allowed → All apps → find AdGuard on the list and set it to Deny.
Meizu
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:
- Go to Advanced Settings → open Battery Manager → set Power plan to Performance;
- Then choose Protected apps in the Battery Manager and check if AdGuard is Protected;
- Go to Apps section and tap AdGuard there → choose Battery → enable Power-intensive prompt and Keep running after screen is off.
Nokia
Nokia devices running Android 9+ have The Evenwell Power saver disabled, which was the main culprit for killing background processes. If AdGuard still gets killed on your Nokia phone, check out the legacy instruction.
Nokia 1 (Android Go)
Install ADB on your computer;
Connect your phone with a data cable;
Enable Developer options;
Enable USB debugging within Developer options on your phone;
Uninstall the com.evenwell.emm package via the following ADB commands:
adb shell
pm uninstall --user 0 com.evenwell.emm
Nokia 3.1 and 5.1
On these devices there is a task killer called DuraSpeed that terminates all background apps. It can't be uninstalled or disabled by regular means. These actions require ADB, and even then, when disabled, DuraSpeed will re-enable itself on reboot. You need a tasker app like MacroDroid for automatic DuraSpeed's disabling.
Install ADB on your computer;
Connect your phone with a data cable;
Enable Developer options;
Enable USB debugging within Developer options on your phone;
Grant MacroDroid (or your choice of automation app) the ability to write to the global settings store by entering this command:
adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS
Create a task triggered at Device Boot that performs the following:
- System Setting: type Global, name
setting.duraspeed.enabled
, value -1 - System Setting: type System, name
setting.duraspeed.enabled
, value -1 - System Setting: type Global, name
setting.duraspeed.enabled
, value 0 - System Setting: type System, name
setting.duraspeed.enabled
, value 0
noteYou need both Global and System type settings. The screenshot shows only Global as an example.
- System Setting: type Global, name
:::
Other Nokia models
Go to phone Settings → Apps → See all apps.
Tap on the right top corner menu → Show system.
Find Power saver app on the list, select it and tap Force close. It will remain stopped for a while but will restart at some point.
From now on, AdGuard should work normally and use the standard Android battery optimizations until Power Saver restarts.
An alternative, more permanent solution for more tech-savvy users:
Install ADB on your computer;
Connect your phone with a data cable;
Enable Developer options;
Enable USB debugging within Developer options on your phone;
Uninstall the com.evenwell.powersaving.g3 package via the following ADB commands:
adb shell
pm uninstall --user 0 com.evenwell.powersaving.g3
Oppo
Sometimes background services are being killed (including accessibility services, which then need re-enabling) when you turn the screen off. So far, a workaround for this is:
Go to Security Centre → tap Privacy Permissions → Startup manager and allow AdGuard app to run in background.
Other solutions:
- Pin AdGuard to the recent apps screen
- Enable AdGuard 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
OnePlus
Devices with OxygenOS on board are the most problematic, with its OS-specific cache cleaning and free RAM, including OS optimization. In addition, OxygenOS can interrupt the AdGuard's work if you do not use it for a while. To avoid these unwanted consequences, follow these steps.
Locking the app
Go to Settings
Battery → Battery optimization
Find AdGuard
Tap on it and select Don't optimize option
Tap Done to save
Open recent apps menu (as showed on this screenshot):
Lock AdGuard app:
On some OnePlus phones there is also a thing called App Auto-Launch and Deep Optimization which essentially prevents apps from working in the background. Please disable it for AdGuard.
Battery optimization
Open device settings → Battery → Battery optimization → switch to the All apps list (top menu) → choose AdGuard → activate Don’t optimize
Open device settings → Battery → Battery Optimization → (⁝) three-dot menu → Advanced Optimization → Disable Deep Optimization
App Auto-Launch
App Auto-Launch (on some OnePlus phones) essentially prevents apps from working in the background. Please disable it for AdGuard.
Enhanced / Advanced optimization
For OnePlus 6 and above:
- Open System settings → Battery → Battery optimization → (⁝) three-dot menu → Advanced optimization
- Disable Deep optimization / Adaptive Battery
- Disble Sleep standby optimization. OnePlus tries to learn when you are usually asleep, and in those times it will then disable the phone’s network connections. This setting will prevent push notifications from being delivered.
For OnePlus below 6:
- Turn off System settings → Battery → Battery optimization → (⁝) three-dot menu → Enhanced optimization.
Recent apps clearing behaviour
Normally when you swipe an app away, it won’t close. On OnePlus this may however work in a different way. Recent app clear behaviour manager might be set up in a way that swiping the app to close will kill it. To return it to the “normal” mode:
Go to Settings → Advanced → Recent app management → Switch to Normal clear
Sony
Sony was the first mobile OS developer to introduce non-standard background process optimization. It is called Stamina mode and it instantly breaks all background processes if enabled. To solve this:
Go to Settings → Battery → Disable STAMINA mode
On Android 11+, on the same screen with STAMINA mode, there is a setting called Adaptive battery, you should disable it too.
You also need to be set AdGuard as Excepted from Power-saving feature:
System settings → Apps & Notifications → Advanced → Special app access → Power saving feature → Switch AdGuard to Excepted
Wiko
Wiko devices are problematic in terms of non-standard background process optimizations. To let AdGuard work in background, do the following:
- Go to Phone Assistant → Battery → turn off Eco Mode
- Go back and go to Manual mode
- Tap on the Gear icon on top right → Background apps whitelist → Select AdGuard
Android stock devices Pixel/Nexus/Nubia/Essential
Android stock OS normally does not conflict with apps 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 VPN and choose AdGuard
Set up Always-on VPN mode