Why Xiaomi is aggressively closing its background apps and how to fix it
Xiaomiโs MIUI 12-based smartphones are known for their tight background management policies. Even if you donโt have performance issues, the system can force messengers, music players or navigators to terminate within minutes of being folded. This isnโt a bug, but a feature of battery optimization that Xiaomi has implemented to increase battery life.
The problem is compounded by the fact that Android itself limits the background activity of applications since version 8.0 (Oreo). MIUI 12 adds layers of optimization to this, and as a result, even popular apps like Telegram, Google Maps, or Spotify can stop working in the background, lose notifications, or reset downloads. Fortunately, there are several ways to get around these limitations, from standard settings to hidden settings and the most common options. ADB-team.
In this article, we will discuss all available methods, from the simplest to the most advanced, requiring root rights.
- ๐ง Set up exceptions for individual applications through the standard menu MIUI
- โ๏ธ Disable battery auto-optimization for all applications at once
- ๐ฑ Use hidden developer settings for fine-tuning
- ๐ป Apply ADB-Rootless teams for deep optimization
- ๐ Working with root access to fully control background processes
Warn in advance: some methods can reduce battery life or affect system stability, and choose your approach based on your priorities of autonomy or functionality.
Method 1: MIUI 12 Standard Settings โ Exceptions for Individual Applications
The safest and most recommended method is to add the right apps to the exclusion list through the MIUI menu, which requires no technical skills and works on all Xiaomi devices without risk to the system.
- Open Settings โ Applications โ Application Management.
- Select an app that should not be closed in the background (like Viber or Yandex Navigator).
- Go to Start (or Auto Run on some firmware).
- Activate options: ๐ Auto-Start โ Allows the application to start when the system starts ๐ฑ Secondary Start โ Allows background activity ๐ Displaying notifications โ prevents blocking notifications
Battery โ No restrictions.
No optimisation
These settings ensure that the selected application is not forced to close by the system, but there are limitations to the method:
- โ It does not work for system applications (e.g. Google Play Services)
- โ Some apps (like Facebook) may ignore these settings.
- โ After updating MIUI settings may reset
โ๏ธ Checking settings for the application
If after these manipulations the application still closes, go to the next way โ disable the overall optimization of the battery.
Method 2: Turning off battery optimization for all applications
MIUI 12 uses an aggressive battery optimization algorithm that is applied by default to all applications, and can be turned off globally, but it will affect the autonomy of the device. If you want to keep background processes running smoothly than an additional 10-15% of your running time, follow the instructions:
- Open Settings โ Battery and Performance โ Battery Management
- Go to App Selection (or Battery Optimization on some firmware).
- In the upper right corner, press three dots (โฎ) and select All Apps.
- For each critical application, select No Limits.
To completely disable optimization:
- Return to Battery Management and turn off MIUI Optimization (may be called Adaptive Battery or Intelligent Control).
- Reset the device.
What happens if you completely shut down battery optimization?
This is effective, but it has side effects. If you want a balanced solution, combine it with the first method โ add only the most important applications to the exceptions, leaving the optimization for the rest.
โ ๏ธ Attention: On some firmware MIUI 12 (Especially for the Redmi Note 8/9 and POCO X3) The option of global optimisation disablement may be hidden. ADB-teams from the next section.
Method 3: Developer settings โ hidden settings to control background processes
If the standard settings don't work, it's time to activate the developer mode, which gives you access to hidden parameters that allow you to more accurately control background activity, and here's how to activate and configure it:
- Go to Settings. โ The phone.
- Click 7 times in a row on the MIUI version until the notification appears You became a developer!
- Return to the main settings menu and open a new section โ For developers.
Now find and change the following parameters:
| Parameter | Recommended value | The effect |
|---|---|---|
| Do not turn off the screen when charging | On. | Prevents screen locking during charging (useful for navigators) |
| Limitation of background processes | No Limits or Max 4 Processes | Increases the number of simultaneous back-end applications |
| Optimization of MIUI (in the Battery section) | Out. | Cancels the forced closure of applications by the system |
| Animation of windows / Animation of transitions | Rejection or ร0.5 | Accelerates switching between applications (indirectly affects background work) |
Pay special attention to the parameter Background Process Limitation. The default value in MIUI 12 is Standard Limit, which is equivalent to 2-3 background processes. Set No Limits if you want applications to stay active longer.
๐ก
If you still close your apps after you change your developer settings, try to further disable Adaptive Brightness in your screen settings, which in some firmware conflicts with background processes.
Remember that these settings are reset when you reset your phone to factory settings, and they may conflict with some system updates, so check them again after you update MIUI.
Method 4: ADB-Teams โ Deep Optimization without root rights
If previous methods didnโt work, itโs time to move on to advanced tools, and with ADB (Android Debug Bridge), you can turn off battery optimization for all applications at once without getting root permissions, which works on MIUI 12 or more, but requires a connection to a computer.
You'll need:
- ๐ฅ๏ธ Computer with Windows, macOS or Linux
- ๐ Installed drivers ADB (You can download from the Google website)
- ๐ USB-cable (preferably original)
- ๐ฑ Included debugging by USB smartphone
Steps to disable optimization:
- Activate USB Debugging in the developer settings (see previous section).
- Connect your smartphone to your computer and confirm the debugging request.
- Open the command prompt (cmd on Windows or Terminal on macOS/Linux) and type:
adb shell
dumpsys deviceidle force-idle
dumpsys battery reset
dumpsys battery set level 100
dumpsys battery set ac 1
dumpsys battery set usb 1
dumpsys battery set wireless 1
settings put global hidden_api_policy 1These commands simulate charging connectivity and disable the limitations of Doze Mode (Android deep sleep mode).
- Enter a command to disable battery optimization for all applications:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle disableNow add specific apps to the whitelist (replace com.example.app with your appโs batch name, such as org.telegram.messenger for Telegram):
adb shell dumpsys battery put inactive com.example.app,0
adb shell am set-inactive com.example.app false๐ก
ADB commands temporarily turn off optimization, but after the phone is restarted, they need to be rerun. For permanent effect, a root or automatic script is required (see next section).
To find the batch name of the application, use the command:
adb shell pm list packages | grep "appendix name"โ ๏ธ Attention: Misuse of the right ADB-commands can cause system instability or data loss. Do not change settings if you are not sure about their purpose. For example, the dumpsys battery reset command resets battery statistics, which can temporarily distort the data on the charge consumption.
Method 5: Root Access โ Full Control of Background Processes
If you're willing to take drastic measures, root access gives you absolute control over the management of background processes, which is suitable for power users, as it requires unlocking the bootloader and installing a customized Recovery (such as TWRP).
- ๐ Ability to disable all restrictions MIUI Android
- ๐ Editing system files responsible for optimization
- ๐ Automation through scripts (e.g. Tasker)
Instructions for root devices:
- Install a file manager with root support (such as Root Explorer or Solid Explorer).
- Cross the path. /system/etc/security/caphs and find the file. battery_saver.xml.
- Open the file in the text editor and replace the line: <bool name="battery_saver_enabled">true</bool> on <bool name="battery_saver_enabled">false</bool>
- Save the file and restart the device.
For a deeper setup, use the Disable Service app (requires root) to disable system optimization services:
- ๐ com.miui.powerkeeper โ the main optimization service MIUI
- ๐ com.android.server.BatteryService โ standard Android battery service
- ๐ com.miui.securitycenter โ a security center that blocks background processes
Disabling these services can cause system instability, overheating or rapid battery discharge. Use only if you understand the risks!
Alternatively, a custom core (e.g., FrancoKernel or ElementalX) can be installed to fine-tune process management, but this requires deep knowledge and can void the warranty.
Additional tips: how to keep the background applications working
Even after all of the above methods have been applied, some applications may continue to close, and here are some additional recommendations for stable operation:
- ๐ App fastening: In multitasking (Recent apps), swipe down the app icon and select Secure.This will prevent it from closing when you clear the memory.
- ๐ Use Do Not Disturb: Some apps (like Google Maps) work better in the background if Do Not Disturb with Allowed Notifications is enabled.
- ๐ Disable Adaptive Brightness: In screen settings, deactivate this option โ it may conflict with background processes.
- ๐ก Network settings: For instant messengers (such as WhatsApp), enable the option to Use Mobile Data in the background in the app settings.
If youโre using Xiaomi with MIUI 12 based on Android 10/11, look for the App Cloner feature (built into the firmware) that allows you to create a duplicate of the application that will work independently of the original and less often close the system.
๐ก
For music players (such as Spotify or VK Music), enable Autoplay in the app settings, which will make the system consider it "active" even when it is rolled up.
Finally, if none of the methods worked, consider switching to custom firmware (like LineageOS or Pixel Experience), which lacks aggressive MIUI optimization and gives more freedom to manage background processes.