How to Make an App Work in the Background on Xiaomi: A Complete 2026 Guide

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:

  1. Open Settings β†’ Applications β†’ Application Management.
  2. Select the application you want (such as Telegram).
  3. Slip on Permissions β†’ Autostart and turn on the switch.
  4. Go back and select the battery. β†’ No restrictions.
  5. 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

  1. Activate Developer Mode: Go to Settings β†’ About Phone and tap the MIUI version 7 times.
  2. Back to Settings β†’ Additionally. β†’ For developers.
  3. Find the option to limit background processes and set without restrictions.
  4. 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:

  1. Install ADB Tools on your PC.
  2. Enable USB debugging in Developer Settings.
  3. Connect your phone to your PC and execute the command:
adb shell dumpsys deviceidle force-idle

Then 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 false

To completely disable MIUI optimization, use:

adb shell settings put global hidden_api_policy 1
List of packages of popular applications
com.whatsapp β€” WhatsApp org.telegram.messenger β€” Telegram com.google.android.apps.fitness β€” Google Fit com.spotify.music β€” Spotify com.netflix.mediaclient β€” Netflix

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:

  1. Go to Settings β†’ Applications β†’ Application Protection.
  2. Turn on protection for the desired application (for example, Viber).
  3. Set a password or fingerprint.
  4. 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).

MethodRequires root/ADBEfficiencyRisks.
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.

FAQ: Frequent questions about the background of applications on Xiaomi

Why do applications close in the background again after the MIUI update?
MIUI Resets some permissions after major updates. Check: Autorun in the app settings. Battery optimization (should be Unlimited). ADB-If the problem persists, try to roll back to the previous version. MIUI via Fastboot.
Can I turn off battery optimization without root?
Yes, partially: βš™οΈ Developer settings β†’ Limitation of background processes. πŸ”Œ ADB-commands (no root, but requires PC). πŸ”’ Application protection (method 4 of the article) Full shutdown is possible only with root rights or custom firmware.
How to check if the application works in the background?
Use it: ADB-Adb shell dumpsys activity activities | grep "mFocusedApp" Monitoring applications: Greenify, Battery Historian. MIUI: Settings β†’ The phone. β†’ Journal of reports.
Will this work on POCO or Black Shark?
Yes, all MIUI-based devices (including POCO, Black Shark, Redmi) use the same optimization mechanisms. Except for the POCO Launcher models, where some of the settings may be in a different menu. For Black Shark, check Settings β†’ Game Mode β†’ Background apps.
Can a constant work in the background damage the battery?
Yes, but not critical. Xiaomi's modern smartphones have: πŸ”‹ Protection against overheating (disconnection during the >45Β°C). πŸ“‰ Optimized charge controllers (in Xiaomi) 13/14 β€” Surge P2). ⚑ Technology MI Fast Charge, which reduces wear and tear during heavy use: Recommendation: if the application is critical (for example, a health tracker), use an external battery to recharge during the day.