Why music stops when the screen is locked
Xiaomi smartphone users often face a problem: their favorite track is interrupted when the screen goes out or you switch to another application, the reason for this is the aggressive optimization of power consumption in the MIUI firmware, which automatically suspends the work of βbackgroundβ processes, especially on budget models (Redmi 9A, Poco M3) and devices with a small amount of RAM.
In this article, weβll look at 5 proven ways to get music to play in the background, from standard MIUI settings to developer-sided bypassing restrictions. All methods have been tested on current firmware versions (including MIUI 14/15 on Android 13/14) and work even on older devices like Xiaomi Mi A2 or Redmi Note 7.
Before you start, make sure that the problem is not in the player itself. For example, YouTube Music and Spotify require a premium subscription for background play, and some streaming services (such as Yandex Music) can block the sound when the application is folded because of the fact that the user is not able to play the video. DRM-Our instructions concern local audio files and players that support the default background mode (Google Play Music, VLC, Poweramp, et al.).
Method 1: Configure auto-optimization in MIUI
The easiest way to do this is to turn off the energy saving for a music app, and in MIUI, this is done via the Battery and Performance menu, but the path may vary depending on the firmware version. On new devices (Xiaomi 13/14, Redmi Note 12), the algorithm is this:
- Open Settings β Battery and Performance β Battery Management
- Select applications (or battery optimization).
- Find your music player on the list (like VLC or Musicolet).
- Select the "No Limits" (or "Not Optimize") mode.
On older versions of MIUI (before MIUI 12), the path is different: Settings β Applications β Application Management β [Select Player] β Battery β No Limits.
β οΈ Warning: After updating the firmware, the battery optimization settings may reset. Check them after each major update MIUI.
If the player still stops, try it again:
- π Reboot your phone after changing your settings.
- π± Remove the application cache (Settings) β Annexes β [Player] β Warehouse β Clear the cache).
- π Disable the "Ultra-Economic" mode in the battery settings (it blocks background processes completely).
Method 2: Permits for background work
MIUI has a hidden menu where you can manually allow an application to run in the background, a method that is particularly useful for streaming services that are often blocked by the system.
- Open Settings β Applications β Application Management.
- Select your music player (such as Spotify or Yandex Music).
- Slip on "Permissions," then "Additional."
- Activate the switches: "Autostart" (allows the player to start when the phone is turned on), "Background activity" (critical for playback when the screen is locked), "Show notifications" (some players require a notification to work in the background).
Android 12+ may require additional permission for βExact Locationβ (yes, thatβs weird, but some players request it to work properly).If itβs not on the list, donβt worry, itβs not critical.
Auto-start on.|Background activity permitted|Notifications activated|Battery optimization is offline-->
If the player still stops, try resetting its default settings: Settings β Apps β [Player] β Additional β Reset settings.
Method 3: Use of notifications (for streaming services)
Some apps (like YouTube Music or SoundCloud) require their notification to remain active for background playback, and if you accidentally "swip" the player's notification, the music will stop.
- During playback of the track, expand the notification panel.
- Find a notification from the player (usually with the buttons "Pause" / "Next track").
- Press the notification and select "Do not delete automatically" (or "Accumulate").
On MIUI 14+, you can also configure notification priority: Settings β Notifications β [Player Name] β Importance β High.
β οΈ Note: Fixed notifications may interfere with everyday use. If the player supports a widget on the lock screen (for example, Poweramp), use it instead of fixing it.
YouTube Music has a separate life hack: turn on the βOnly Soundβ mode (button in the player), and the notification will be less intrusive, but the music will continue to play in the background.
π‘
If the player notification disappears after the screen is locked, check the lock screen settings in MIUI. Turn off the option "Hide confidential content" - it can block media notifications.
Method 4: ADB-Teams for Advanced Users
If standard methods don't work, you can manually turn off optimization via ADB (Android Debug Bridge), which requires a computer and a little bit of technical skill, but it gives 100% results.
- Turn on Developer Mode on your phone: Settings β About Phone β MIUI version (shap 7 times).
- Activate "Debugging by" USB" in the developer menu (Settings) β Additionally. β For developers).
- Connect your phone to your PC and execute the command in the terminal/command line: adb shell dumpsys deviceidle whitelist +com.example.music (replace com.example.music with your player package, for example, com.spotify.music or com.maxmpz.audioplayer for Poweramp).
- To completely disable optimization, use: adb shell settings put global hidden_api_policy 1 (requires a reboot of the phone).
To install any of these players:
- Download APK from the official website (for example, musicolet.com for Musicolet).
- Allow installation from unknown sources (Settings β Applications β Special Rights β Installation of Unknown Applications).
- After installation, immediately open the battery settings for the new player and turn off optimization (see Method 1).
Musicolet and VLC donβt require additional permissions to work in the background, unlike streaming services, making them ideal for Xiaomi devices with low RAM (for example, Redmi 8A or Poco C31).
π‘
Alternative players (Musicolet, VLC) often work in the background βout of the boxβ, while popular streaming services (Spotify, YouTube Music) require additional settings or premium subscriptions.
Additional Advice and Frequent Mistakes
Even after all the settings, the music can be interrupted due to the specific features of MIUI.
- π Performance mode: In some firmware (MIUI 13 for Poco) has a separate Performance switch in the battery settings. Set it to High".
- π΅ Traffic savings: If you listen to music over the mobile Internet, turn off background traffic restriction for the player (Settings) β SIM-maps and mobile networks β Transfer of data β Saving traffic).
- π Autocleaning RAM: V MIUI There's a memory clearing feature when you lock the screen. Turn it off in Settings. β Additionally. β Cleanup.
A common mistake is that users confuse background play (music plays when the screen is locked) and multitasking (music plays when the app is rolled up). For example, Spotify can work in a rolled-up form, but stopping when the screen is locked is different and is solved in different ways.
If you use custom firmware (like LineageOS or Pixel Experience), there are usually no problems with background music, but remember that informal firmware can take away your warranty and stability.