How to permanently ban Xiaomi and Android from completing programs in the background on MIUI 12

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.

๐Ÿ“Š How often do you get annoyed by the automatic closing of background apps on Xiaomi?
It's always interfering with work.
Sometimes, but tolerably.
I used to worry, but I found a solution.
It's not my business.

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.

  1. Open Settings โ†’ Applications โ†’ Application Management.
  2. Select an app that should not be closed in the background (like Viber or Yandex Navigator).
  3. Go to Start (or Auto Run on some firmware).
  4. 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

Done: 0 / 4

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:

  1. Open Settings โ†’ Battery and Performance โ†’ Battery Management
  2. Go to App Selection (or Battery Optimization on some firmware).
  3. In the upper right corner, press three dots (โ‹ฎ) and select All Apps.
  4. For each critical application, select No Limits.

To completely disable optimization:

  1. Return to Battery Management and turn off MIUI Optimization (may be called Adaptive Battery or Intelligent Control).
  2. Reset the device.
What happens if you completely shut down battery optimization?
Without optimization, applications will be able to work freely in the background, but this will lead to: - Increase battery consumption by 15-30% (depending on the model) - Possible overheating of the device during intense background activity - Faster battery wear due to frequent discharge cycles - Slow down the system if there are many heavy applications running in the background (for example, games or video editors).

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:

  1. Go to Settings. โ†’ The phone.
  2. Click 7 times in a row on the MIUI version until the notification appears You became a developer!
  3. Return to the main settings menu and open a new section โ†’ For developers.

Now find and change the following parameters:

ParameterRecommended valueThe effect
Do not turn off the screen when chargingOn.Prevents screen locking during charging (useful for navigators)
Limitation of background processesNo Limits or Max 4 ProcessesIncreases 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 transitionsRejection or ร—0.5Accelerates 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:

  1. Activate USB Debugging in the developer settings (see previous section).
  2. Connect your smartphone to your computer and confirm the debugging request.
  3. 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 1

These commands simulate charging connectivity and disable the limitations of Doze Mode (Android deep sleep mode).

  1. Enter a command to disable battery optimization for all applications:
adb shell dumpsys battery unplug


adb shell dumpsys deviceidle disable

Now 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:

  1. Install a file manager with root support (such as Root Explorer or Solid Explorer).
  2. Cross the path. /system/etc/security/caphs and find the file. battery_saver.xml.
  3. 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>
  4. 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.

FAQ: Frequent questions about background processes in MIUI 12

๐Ÿ”น Why After Updating MIUI settings are reset and applications are closed again?
When updating firmware MIUI It resets some battery optimization settings. It's done to prevent conflicts with the new version of the system. To avoid problems: Before you update, take screenshots of your current settings. After you update manually restore application exceptions. Use ADB-commands for mass application of settings (see Method) 4). If the update came "over the air" (OTA), Check the settings through 1-2 Sometimes the optimization is delayed.
๐Ÿ”น Can you turn off optimization for system-only applications (e.g. Google Play Services)?
System applications are protected from change without root rights. However, there is a workaround: Use ADB-The command to add to the white list: adb shell dumpsys deviceidle whitelist +com.google.android.gms (replace com.google.android.gms with the desired package). Google Play Services will also help disable the option Optimize Google Play in Google account settings. Without root access, you can not completely disable optimization for system applications.
๐Ÿ”น How to Check Which Apps Are Closing in the Background?
Use it for monitoring: ๐Ÿ“Š Built-in monitor: Settings โ†’ Battery โ†’ Battery utilization โ†’ Select the app and see the activity schedule. ๐Ÿ” Third-party utilities: Apps like Greenify (with Donate for Xposed) or AccuBattery show when and why the app was closed. ๐Ÿ“ Logs of the system: Through ADB Follow the command: adb logcat | grep -i "This will show you a list of forced shutdowns. Notice apps marked trimmed or killed by am, they were closed by the system.
๐Ÿ”น Will these methods work for MIUI 13/14?
Basic principles (exceptions in settings, ADB-Root teams also work on newer versions. MIUI, but: ๐Ÿ”„ Menu paths may change (for example, Battery Management moved to Settings) โ†’ Battery โ†’ Battery settings). ๐Ÿ”ง Some of them ADB-The commands require updates (e.g., in the MIUI 13 added verification of team signatures). ๐Ÿ›ก๏ธ V MIUI 14, a new Memory Extension mechanism has appeared that can conflict with manual settings. For current instructions, check the firmware version in Settings โ†’ The phone. โ†’ Version. MIUI.
๐Ÿ”น How to return the standard settings, if after the changes the phone began to brake?
If after optimizing the device started to work unstable: Reset the battery settings: adb shell dumpsys battery reset Return the limitations of background processes in the developer settings. MIUI If you used root, restore the original file. battery_saver.xml In extreme cases, reset to factory settings (Settings) โ†’ The phone. โ†’ Resetting settings), but it will delete all data.