Why Apps Close in the Background on Xiaomi and How to Fix It
Xiaomi smartphones based on MIUI They are known for aggressive battery optimization, which often leads to forced closure of applications in the background, including messengers (Telegram, WhatsApp), trackers (Google Fit, Strava), VPN-Customers and even system services, the problem gets worse after the updates. MIUI 14/15, where energy saving algorithms have become even stricter.
In this article, you will find current methods for all modern Xiaomi models (from Redmi Note 12 to Xiaomi 14 Ultra), including hidden settings, ADB commands and bypassing the limitations of MIUI. We will analyze both standard system tools and advanced tricks for power users.
β οΈ Important: Some methods require unlocking the bootloader or root rights, and may result in loss of warranty or unstable operation of the device!
Method 1: Setup autostart and background activity
The first step is to enable auto-run and allow background work for the target application, which is a basic setup, but many users miss it because they think it's not enough.
Instructions for MIUI 14/15:
- Open Settings β Applications β Application Management.
- Select the application you want (such as Telegram).
- Slip on Permissions β Autostart and turn on the switch.
- Go back and select the battery. β No restrictions.
- In the Other Permissions section, enable Show over other windows and Work in the background.
β οΈ Attention: After update MIUI These settings can be reset! Check them once in a while. 1-2 month.
Auto-start is on.|Work in the background is allowed|Battery without restrictions|Permission to "Show over other windows"-->
Method 2: Disable battery optimization through hidden menu
MIUI hides some optimization settings, but they can be activated through the developer menu or secret codes.
Method 1: Through Developer Settings
- Activate Developer Mode: Go to Settings β About Phone and tap the MIUI version 7 times.
- Back to Settings β Additionally. β For developers.
- Find the option to limit background processes and set without restrictions.
- Turn off MIUI Optimization (if available).
Method 2: Secret code (not working on all models)
##4636##In the menu that opens, select Battery Information β Battery Manager and turn off optimization for the desired application.
Redmi Note 12/13|Xiaomi 13/14|POCO X5/F5|Redmi 12/13|Another model-->
Method 3: Use ADB-deep-tuning commands
If standard methods donβt work, youβll need to connect to your device via the Android Debug Bridge (ADB), which will disable system-level optimization.
Step-by-step:
- Install ADB Tools on your PC.
- Enable USB debugging in Developer Settings.
- Connect your phone to your PC and execute the command:
adb shell dumpsys deviceidle force-idleThen for a specific application (e.g. Telegram with the org.telegram.messenger package):
adb shell dumpsys battery unplug
adb shell am set-inactive org.telegram.messenger falseTo completely disable MIUI optimization, use:
adb shell settings put global hidden_api_policy 1List of packages of popular applications
Method 4: Setup Application Protection (App Lock)
Application Protection in MIUI not only blocks password access, it also prevents secure applications from being closed by the system, which works even after a reboot.
How to set up:
- Go to Settings β Applications β Application Protection.
- Turn on protection for the desired application (for example, Viber).
- Set a password or fingerprint.
- Enable the option to Block in the background.
β οΈ Note: if you forget the password from Application Protection, you can only reset it through a full reset (hard reset).
| Method | Requires root/ADB | Efficiency | Risks. |
|---|---|---|---|
| Auto Start + Battery | β No. | ββ (middle-class) | Resets after updates |
| Debugging by USB + ADB | β Yes. | ββββ (high-pitched) | Resetting when resetting settings |
| Application protection | β No. | βββ (good-natured) | You can block yourself. |
| Magisk + modules | β Root | βββββ (maximum) | Loss of warranty, risk of brick |
Method 5: Advanced solutions (root and magisk)
If you are ready for radical measures, getting root rights and installing Magisk will give you access to modules that completely disable MIUI optimization.
Recommended modules for Magisk:
- πΉ Disable MIUI Optimization β Disables all background restrictions.
- πΉ Universal GMS Doze β prevents the shutdown of Google services.
- πΉ Greenify4Magisk β Flexible application hibernation management.
- πΉ Battery Optimizer Disabler β Blocks Battery Optimization.
β οΈ Note: Installing Magisk on new Xiaomi models (e.g. Xiaomi 14) may result in encryption blocking or banking applications inoperability (due to SafetyNet).
π‘
Before installing Magisk, back up the persist partition via TWRP. This will help restore IMEI and modem data when you crash.
Method 6: Alternative solutions (if nothing helps)
If all of the above methods fail, consider alternative approaches:
- π± Using a second device: Some users are holding an old smartphone (e.g. Redmi) 4A) background-specific.
- βοΈ Cloud services: Move some of the features to the web version (for example, Telegram Web on PC).
- π Automation via Tasker: Set up scripts for periodic app alarm clock.
- π οΈ Custom firmware: Switching to LineageOS or Pixel Experience completely solves the problem, but requires technical skills.
Critical information: on devices with MIUI Global (especially in the European region), background restrictions are stricter than in MIUI China. Some users solve the problem by flashing to the Chinese version, but this requires unlocking the bootloader and carries risks.