A familiar situation: you switch from the map to the messenger, and after a couple of minutes you return back, but the application restarts from the very beginning? This is an annoying behavior of the Android system that is often confused with a bug, although in fact it is an aggressive one. The operating system strives to free up random access memory (RAM) for the currently active task, mercilessly killing processes that, in its opinion, are not needed right now. memory management policy. The operating system strives to free up random access memory (RAM) for the currently active task, mercilessly killing processes that it determines are not needed right now.

This problem is especially acute on smartphones from Chinese manufacturers, such as Xiaomi, Honor or Realme, where proprietary shells have their own, very strict “energy saving” algorithms. However, even with “pure” Android from Google, you may encounter the fact that important work tools or music players fly out of memory. The solution exists, and it lies in the level of deep adjustment of system restrictions.

In this article we will analyze all the available methods: from simple settings in the menu to advanced commands via USB debugging. You will learn how to create exceptions for specific apps so that they remain in RAM for as long as you like until you close them yourself.

⚠️ Attention: Forcibly keeping a large number of applications in memory can lead to accelerated battery drain and slowdown of the smartphone itself due to a lack of free resources.

Why the system kills background ones processes

To effectively deal with a problem, you need to understand its nature. The mechanism responsible for unloading applications is called Low Memory Killer (LMK). It monitors the level of free RAM and, when it runs out, begins sequentially killing processes, starting with the least important ones.

Modern versions of Android (starting from 11 and above) have become even stricter about background activity for privacy and energy efficiency purposes. The system automatically restricts access to the microphone, geolocation and network for minimized apps. If an application tries to run in the background without the user's explicit permission, Android OS forcefully stops it.

In addition, smartphone manufacturers add their own add-ons. For example, the shell MIUI or ColorOS may have a separate task manager that clears memory immediately after the screen is locked, ignoring standard system settings. This is done in order to guarantee the stated battery life, but often harms the user experience.

📊 How often do your applications crash in the background?
Constantly, every 5 minutes
Sometimes, when there is not enough memory
Only after blocking screen
Never, everything works stably

Setting exceptions in the battery menu

The easiest and safest way to solve the problem is to configure power consumption settings for a specific application. This is a system that this app is a priority and should not be optimized. The algorithm of actions may differ slightly depending on the model of your device.

In most cases, the path looks like this: go to Settings → Applications → Select the desired application → Battery. Here you will see several operating modes. You need to select the option "No restrictions" or Unrestricted. By default, it is often set to “Optimized,” which leads to the application closing when minimized.

On smartphones Samsung s With the One UI shell, this setting can be hidden deeper. Sometimes you need to go to the Device care → Battery → Background restrictionssection. Here you need to make sure that your application is not in the "Apps in Deep Sleep" list. If it is there, remove it from there by adding it to the exceptions.

  • 🔋 “No restrictions” mode allows the application to run in the background even when the screen is off.
  • 🚫 Adding to “Deep Sleep” ensures that the application will never launch itself until you open it.
  • ⚡ Disabling battery optimization often solves the problem with notifications freezing.

⚠️ Attention: The settings interface may change with firmware updates. If you do not find the exact menu item, use the search in settings by entering the word “Battery” or “Optimization.”

Pinning an application in RAM

Many users do not know about the existence of the “Pin” or “Lock” function in the recent applications menu. This is a manual command to the system not to unload a specific process from RAM, even if memory is critically low. This is analogous to the “hold in memory” function on computers.

To use this method, open the menu of running applications (usually swipe up from the bottom with a hold or the square button). Find the application card you need. On some shells you need to click on the application icon on top of the card, on others you need to swipe down on the card itself or click on three dots.

In the menu that appears, select the item “Pin” or click on the lock icon 🔒. After this, a lock symbol will appear next to the application icon. This is a signal to the task manager Androidthat this process is protected from automatic cleaning. Even if you click the “Clear all” button, the pinned application will remain running.

💡

Pin only 1-2 of the most important applications (for example, a navigator or instant messenger). If you pin a dozen apps, you will actually disable the memory cleaning mechanism, which will lead to slowdowns in the interface.

Using developer mode

If the standard settings do not help, you can access the hidden capabilities of the system through the developer menu. More subtle process control settings are found here. However, be careful: changing the settings incorrectly can lead to unstable system operation.

You must first activate developer mode. Go to Settings → About phone and quickly click 7 times on the item "Build number". After the “You have become a developer” message appears, return to the main settings menu. A new section will appear there System → For developers.

Inside this section, find the "Applications" subsection. We are interested in item "Limit of background processes". By default, it is set to “Standard Limit”. You can change it to “No background processes” (not recommended!) or, conversely, select a limit of 4 or more processes. But a more effective setting is the item Do not save actions —make sure that it is turned off.

Option Recommended value Impact on the system
Limit of background processes Standard limit Balance between memory and autonomy
Do not save actions Disabled Allows applications to remain in history
Background scanning Enabled Allows data collection in the background
Window animation 0.5x or 1x Visual effect, does not affect operation

⚠️ Attention: Changing the background process limit to “No limits” in the developer menu is not recommended for everyday use, as this can lead to memory overflow and rebooting the smartphone.

Advanced method via ADB commands

For those who are not afraid of the command line, there is the most reliable way - using the utility ADB (Android Debug Bridge). This method allows you to set process priority at the kernel level, which is often ignored even by aggressive manufacturer optimizers.

You will need a computer with ADB drivers installed and USB debugging enabled on your smartphone. Connect your phone to your PC and open Command Prompt. First, find out the package name of the application that needs to be pinned. This can be done through the command:

adb shell dumpsys window windows | grep -E'mCurrentFocus|mFocusedApp'

After getting the package name (for example, com.telegram.messenger), we can use the command to change the importance level of the process. However, a softer and safer option is to disable specific optimizations via ADB:

adb shell pm grant com.package.name android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS

This command forces the application to ignore battery optimization, which often works better than manual settings in the menu. Please note that for some system applications this method may not work due to the developer signature.

What to do if ADB does not see the device?

Make sure that a window asking “Allow debugging?” appears on the phone screen. Click "Always Allow" and "OK". Also try replacing the USB cable or connection port, as some cables only support charging.

Features of Chinese firmware (MIUI, ColorOS)

Smartphone owners Xiaomi, Poco, Oppo i Vivo face the problem more often than others. These shells have a separate service "Autostart", which works regardless of Android system settings. If the application is not added to this list, it will be killed immediately after minimizing.

Go to the "Security" application (green icon with a lightning bolt), which is pre-installed on such phones. Go to section Permissions → Autorun. Find the application you want and turn on the switch next to it. This will give the app the right to start on its own and restore its operation after closing.

There is also a section in “Security” Battery → Energy Saving. Find your application and check the box next to "No restrictions". Only the comprehensive use of all three settings (autostart, battery, pinning in the task menu) guarantees stable operation on Chinese firmware.

  • 🛡️ The “Security” application has the highest priority over system settings Android.
  • 🔄 Without permission to “Autostart”, messengers may not send notifications.
  • 📱 On MIUI sometimes you need to additionally enable “Advanced optimization” in the developer menu.
💡

On smartphones with Chinese shells, the standard Android settings are not enough. Be sure to use the built-in Security application to grant all necessary permissions.

Additional questions and answers

Why does the application close even after all the settings?

Perhaps the application itself has errors in the code or incorrectly requests resources. Try clearing the app's cache in settings or reinstalling it. Also check if the Data Saver mode is enabled, which may block background network activity.

Is it harmful to keep many applications in memory?

Modern RAM (LPDDR5) is designed to work constantly. An empty memory is a useless memory. The harm is caused not by storing applications in RAM, but by their active background activity (constant GPS, screen brightness, network), which drains the battery.

How to check if an application is running in the background?

Go to Settings → Applications → Special access → Access to notifications or use the section Battery usage. It will show how much time the application has been running in the background over the last 24 hours.

Are settings reset after rebooting the phone?

Settings in the “Battery” and “Autostart” menus are saved permanently. However, pinning an application to the task menu (lock icon) may be reset after a full reboot of the device on some models, so check this item after turning on the phone.

Is it possible to completely disable process killing?

It is impossible to completely disable the mechanism Low Memory Killer without root access, since this is a critical component of the Linux kernel, on which built by Android. Attempts to bypass this through third-party tweakers can lead to a “bootlap” (cyclic reboot).