Have you noticed that your favorite application suddenly closes or restarts when switching between tasks? This is due to the Androidmemory management mechanism, which automatically preempts background processes to free up resources. The problem is especially pressing for devices with 2-4 GB of RAMwhere the system aggressively optimizes memory consumption. But what if you need the messenger, music player or navigator to work in the background without restarting?
In this article we will analyze 7 proven methods - from standard settings to advanced tricks with ADB and modification of system parameters. It's important to understand that some methods require root access or technical knowledge, while others work on any device without compromising your warranty. We will also explain why on new versions of Android (12+) classic methods with process limitation may not workand what to do about it.
Why Android unloads applications from memory
The operating system Android uses a mechanism Low Memory Killer (LMK) โa special kernel driver that monitors free memory. When there is little of it left, LMK forcibly closes processes by priority:
- ๐ด Background (invisible to the user, for example, mail synchronization)
- ๐ก Service (music in the player, downloading files)
- ๐ข Visible (minimized applications that you recently used)
- ๐ต Active (current application on the screen)
On devices with 6+ GB of RAM LMK works less often, but even flagships are not immune from unloading - it all depends on manufacturer (for example, Xiaomi and Realme aggressively clean background processes in their shells MIUI and Realme UI). Key factors influencing unloading:
| Factor | Impact on unloading |
|---|---|
| Amount of RAM | Less than 4 GB - upload more often, especially with multitasking |
| Android version | Starting with Android 8.0 restricted background services |
| Manufacturer and shell | Samsung One UI spares background services processes, but ColorOS no |
| Energy saving settings | The "Battery Saver" or "Super Saving" modes kill background tasks |
โ ๏ธ Attention: On some devices (for example, Huawei s EMUI) even disabling battery optimization does not guarantee stable operation of background applications. This is due to the deep integration of proprietary memory management algorithms.
Method 1: Disabling battery optimization for an application
The safest and most universal method is to exclude the application from the list of optimized ones. This prevents the system from forcing it to close. The instructions are relevant for Android 6.0+:
- Open
Settings โ Applications. - Select the desired application (for example, Telegram or Google Maps).
- Tap on
Battery(orBattery optimization). - Select
Do not optimizeorNo restrictions.
On some devices (for example, Samsung), the path may be different:
Settings โ Device maintenance โ Battery โ Three dots (โฎ) โ Settings โ Optimize application performance โ Select application โ Disable
โ ๏ธ Attention: On Android 12+ this method may not work for applications that use background services (for example, instant messengers with notifications). In this case, a combination with other methods will be required.
โ๏ธ Checking battery optimization
Method 2: Fixing the application in multitasking (for Android 10 and below)
On older versions Android (up to the 11th inclusive) there was a "Pin" function (Pin), which prevented the minimized application from unloading. How it works:
- Open the application you want to pin.
- Click on the square button (multitasking).
- Swipe up on the application card and hold - a pin icon will appear.
- Confirm the action.
โ ๏ธ Attention: On Android 11+ this function was removed due to changes in security policy. Instead, manufacturers have implemented their own solutions (for example, Samsung offers "Block in multitasking" in One UI).
For devices Xiaomi s MIUI there is an alternative:
Settings โ Accessibility โ Pinning applications โ Enable
What to do if there is no "Pin" option
On some firmware (for example, ColorOS) this function is hidden. Try using it. data-i="130">-command: ADB-command:
adb shell settings put global lock_to_app_enabled 1
After that, reboot the device and check for the option in the multitasking menu.
Method 3: Using ADB to change the priority of a process
If standard methods do not help, you can manually increase the priority of the application via ADB (Android Debug Bridge). This method does not require root, but requires USB debugging. Instructions:
- Enable
Developer mode(tap the build number 7 times inSettings โ About phone). - Activate
USB debuggingin the developer settings. - Connect the phone to the PC and run the command:
adb shell am set-inactive falseFor example, for WhatsApp:
adb shell am set-inactive com.whatsapp false
For a permanent effect, add the application to the "uninstallable" list:
adb shell pm hide
โ ๏ธ Attention: On Android 13+ these commands may not work due to stricter security policies. In this case, you will need to use Shizuku or alternative methods.
adb shell pm list packages | grep "application_name"
For example, for VK:
adb shell pm list packages | grep "vk"-->
Method 4: Changing LMK parameters (requires root)
For experienced users with root access it is possible to configure Low Memory Killer manually. This allows you to increase the threshold of free memory at which the system begins to kill processes. Steps:
- Install a file manager with support root (for example, Root Explorer).
- Open the file
/sys/module/lowmemorykiller/parameters/minfree. - Change the values (example for 4 GB RAM):
18432,23040,27648,32256,36864,41472The higher the numbers, the less often the LMK will trigger.
Alternatively, you can use the application Kernel Adiutor (requires root):
- ๐ฑ Go to section
Memory. - ๐ง Find the option
LowMemoryKiller. - โ๏ธ Edit the values
minfreeaccording to the table:
| RAM volume | Recommended values minfree |
|---|---|
| 2 GB | 8192,10240,12288,14336,16384,18432 |
| 4 GB | 18432,23040,27648,32256,36864,41472 |
| 6+ GB | 36864,46080,55296,64512,73728,82944 |
โ ๏ธ Attention: Incorrect values minfree can lead to system freezes or excessive battery consumption. Before making changes, make a backup copy of the original settings.
Changing LMK settings is the most effective method for rooted devices, but requires caution. Start with minimal changes and test stability.
Method 5: Using applications to block uploading
If manual methods seem complicated, you can use specialized utilities. They work on two principles:
- Activity emulation โthe application periodically โwakes upโ the target process, simulating its use.
- LMK blocking โintercepts system signals about low memory (requires root).
Popular tools:
- ๐ก๏ธ Greenify (for hibernating unnecessary processes, freeing up memory for important ones).
- ๐ Keep Alive (prevents unloading of selected applications).
- ๐ Servicely (restarts background services after unloading).
Configuration example Keep Alive:
- Give the application rights
AccessibilityandOverlay on top of other windows. - Add the desired applications to the protection list.
- Activate option
Prevent app kill.
โ ๏ธ Attention: Applications like Keep Alive can increase. battery consumption by 10-15%, as they constantly keep processes active. Disable them if you notice the device overheating.
Method 6: Setting process limits (for older versions of Android)
On Android 7.0 and below there was a hidden parameter that limits the number of background processes. It can be changed through ADB or the application Developer Options:
- Turn on
Developer Mode(as in Method 3). - Go to
Settings โ System โ For developers. - Find the option
Process LimitorLimit background processes. - Select
Without restrictionsor the maximum value (for example,4 processes).
For Android 8.0+ this parameter is hidden, but it can be changed through ADB:
adb shell settings put global bg_process_limit 10
(where 10 is the maximum number of background processes)
โ ๏ธ Attention: On new versions Android (12+) this method does not work due to changes in the memory management mechanism. Manufacturers (for example, Google v Pixel) have completely removed this option.
Alternative for new Android
On devices with Android 11+ you can try using Shizuku + AppOps to manually manage application rights. This will allow you to bypass some restrictions, but does not guarantee 100% results.
Method 7: Modifying the firmware (for advanced users)
If none of the methods helped, a radical solution remains - modifying the system files. This is suitable for users with root and experience with custom firmware. Options:
- ๐ฑ Installing a custom kernel (for example, FrancoKernel or ElementalX) with custom LMK.
- ๐ง Editing
build.propโ adding lines:ro.config.low_ram=falsedebug.override_lmk_thresholds=1 - ๐ ๏ธ Using Magiskmodules like LMK Tweaks for fine tuning.
Example of installing a module via Magisk:
- Download the module LMK Tweaks from the repository Magisk.
- Install it through the app Magisk Manager.
- Reboot the device.
- Configure the parameters in the file
/sdcard/lmk_parameters.conf.
โ ๏ธ Attention: Incorrect modification system files can lead to "briku" device (inability to boot). Always make a backup copy through TWRP before making changes.
Modifying the firmware gives maximum control over memory management, but requires deep technical knowledge and risks system stability.
FAQ: Frequently asked questions about unloading applications
Why does the application unload even after all the settings?
On some devices (for example Xiaomi, Huawei) manufacturers block standard methods through deep integration of their algorithms. Try:
- Disable "Auto-optimization" in the security settings.
- Add the application to the "White List" (if there is such an option).
- Use ADBcommands to forcefully disable optimization:
adb shell dumpsys deviceidle whitelist +
How to check if an application is unloaded from memory?
Use ADB-command to monitor processes:
adb shell dumpsys meminfo | grep "package_name"
Or install the application Process Monitor from Google Play. It shows the status of processes in real time.
Is it safe to use root for these purposes?
Using root always involves risks:
- ๐ด Loss of warranty (if the device is under warranty).
- ๐ด Vulnerability to malware (applications gain access to system files).
- ๐ด Possibility of a "brick" due to incorrect changes.
If you are a beginner, start with methods without root (for example, Method 1 or Method 5).
Why is it more difficult to prevent uploading on new Androids (12+)?
Starting with Android 12, Google tightened the policy background processes:
- ๐น Limited number background services (maximum 10 per hour).
- ๐น Introduced CPU usage quotas for background tasks.
- ๐น Blocking
ADB-commands for changing system parameters without root.
Manufacturers (for example, Samsung v One UI 4+) also add their own restrictions. In such cases, only a combination of methods or custom firmware will help.
Which method is the most reliable for devices without root?
For most users, the optimal combination:
- Disable battery optimization (Method 1).
- Use Keep Alive or Servicely (Method 5).
- Configure exceptions in proprietary utilities (for example,
Autorunin MIUI).
This gives ~80% success without risks to the system.