Modern smartphones based on the Android operating system are distinguished by a smart RAM management system. However, this system sometimes becomes overly aggressive by forcefully terminating processes that the user would like to keep running in the background. This is especially true for instant messengers, navigators, sleep trackers, or podcast recording applications. Users often encounter a situation where the music stops and notifications do not arrive precisely because the system decided to save resources.

The solution to this problem lies in deep system customization. You'll have to change battery settings, activate hidden developer menus, and manually set priorities for specific apps. The process is not complicated, but requires care, since interfering with the task scheduler can affect the autonomy of the device. If your goal is to ensure that a critical application is not killed by the system, follow the instructions below.

Why Android forcefully terminates processes

The Android operating system is built on the principle of efficient resource allocation. When free RAM becomes scarce, the system begins to analyze running processes. Applications that are not currently in use and are not of high priority are marked as candidates for termination. This is normal behavior designed to prevent the interface from freezing and ensure smooth operation of active windows.

However, the algorithms can make mistakes. For example, background process the navigator may be perceived by the system as unnecessary if the screen goes dark. As a result, the route is reset. Smartphone manufacturers often add their own add-ons on top of pure Android, such as MIUI from Xiaomi or OneUI from Samsung. These shells have their own, even more stringent power-saving algorithms that aggressively close background services to extend battery life.

Understanding the mechanism of work Low Memory Killer (process killers when there is low memory) helps to understand why simply switching between windows does not always save application. The system does not look at whether the window is visually open, but at how long ago the application interacted with the user and what its status is in the priority queue.

⚠️ Attention: Disabling system restrictions on closing applications will increase battery consumption. Active background processes consume CPU and network resources even when the screen is in standby mode.

Setting up battery optimization for specific applications

The very first and most effective step is to exclude important apps from the battery optimization list. By default, Android expects all apps to save power by limiting their background activity. You need to manually tell the system that a specific application is an exception to this rule.

Go to the main settings of your device and find the section responsible for power. The path may differ depending on the model: usually it is Settings → Battery → Battery optimization or Settings → Applications → Accessibility → Battery optimization. In this list you will see all installed apps. By default, only those that are optimized are displayed.

Click on the drop-down list at the top of the screen and select the “All apps” option. Find the desired app in the list (for example, a messenger or a player) and switch the toggle switch to the “Do not optimize” or “No restrictions” position. This will give the application the right to work in the background without restrictions on time and frequency of access to the network.

💡

To quickly access the battery settings of a specific application, you can hold down the app icon on the desktop, click “About the application” (the “i” icon) and immediately go to the “Battery” section.

After making changes, the system will no longer forcefully put the selected application to sleep. However, on some shells, such as MIUI or ColorOS, this may not be enough. There are additional levels of control, such as “Autorun” and “Background processes”, which also require manual activation in the corresponding security menus.

Activating developer mode and setting limits

If the standard battery settings did not help, you need to turn to the advanced capabilities of the system. Android has a hidden menu for developers where you can globally change the background process management policy. This is a powerful tool that allows you to prevent the system from killing processes even when there is not enough memory.

First you need to activate this mode. Go to Settings → About phone and find the item “Build number”. Click on it quickly 7 times in a row. The system will ask for your screen unlock password, after which a notification “You have become a developer” will appear. Now a new section will appear in the settings menu System → For developers.

Inside this menu, find the “Applications” section. There you will find the “Background Process Limit” option. By default, it can be set to “Standard limit” or “No more than 4 processes”. Change this value to "No restrictions". This action will remove the artificial barrier to the number of apps running simultaneously in the background.

☑️ Activating developer mode

Completed: 0 / 1

Also in the developer menu you should pay attention to the “Do not save actions” item. Make sure this switch is turned off. If it is active, the system will destroy the application activity as soon as the user leaves it, which completely contradicts your goal of keeping the app running.

Parameter Recommended value Impact on the system
Background process limit No restrictions Allows many applications to run simultaneously
Do not save actions Disabled Saves application state when minimized
Background process limit Standard / No limit Controls the queue of closing old tasks
Window animation 0.5x or Off Visually speeds up work, does not affect the background

Use “Screen Pinning” functions

There is a radical but reliable way to keep an application in the foreground - the screen pinning function. This mode locks the device to one specific application. The user will not be able to minimize it or go to another menu without performing a special button combination. This is ideal for situations where you want the application to run in priority and not be interrupted.

To enable this feature, go to Settings → Security → Advanced settings → Screen pinning (path may vary). Activate the switch. Now open the desired application, call up the recent tasks menu (square button or swipe from below and hold) and click on the application icon above the app window. Select the “Pin” option.

While the screen is pinned, the system considers this application to be the only active user and will not try to close it or unload it from memory. This also prevents accidental clicks that could crash the app. To exit the mode, you usually need to simultaneously hold down the “Back” and “Browse” buttons (or swipe up from the bottom and hold, depending on the type of navigation).

The nuances of how pinning works on different versions of Android

On Android 10 and higher, when exiting pinning mode, the system may require you to enter a PIN code or fingerprint to unlock. This is a security measure to ensure that an unauthorized person does not gain access to your phone by simply exiting the pinned application.

It is worth considering that when you pin the screen, notifications from other applications may not be displayed, since the focus is completely shifted to one task. Use this method situationally, for example, while navigating or recording an important conversation, when accidental switching is unacceptable.

Specifics of the operation of Xiaomi, Samsung and Huawei shells

Owners of smartphones from popular Chinese brands are faced with a more difficult task. Manufacturers Xiaomi, Huawei and Honor implement aggressive memory managers that work regardless of standard Android settings. Even if you have disabled battery optimization, the proprietary utility may close the application after a few minutes of inactivity.

On devices Xiaomi with the MIUI or HyperOS shell, you must go to the “Security” application. There, find the section “Permissions” → “Autorun”. Turn on the switch next to the desired application. In addition, in the battery settings inside the application menu, you must select the “No restrictions” mode. Without performing both actions, the system is almost guaranteed to close the app.

Devices Samsung with the OneUI shell have the “Deep Sleeping Apps” function. Check the list in Battery Settings. If your application gets there, it will be completely immobilized in the background. Move it to the "Never Sleeping Apps" list. It's also worth disabling the Adaptive Battery feature, which learns your habits and can mistakenly classify rarely used but important background processes as unnecessary.

📊 What Android skin do you have installed?
Pure Android (Pixel, Motorola):OneUI (Samsung):MIUI / HyperOS (Xiaomi):ColorOS / Realme UI (Oppo, Realme):Other

For owners Huawei i Honor it is critical to configure the launch control manually. In the battery menu, find “Launch applications”, disable automatic control and manually allow the application to autostart, secondary launch and run in the background. Ignoring any of these three points will result in the service stopping.

Advanced methods: ADB and third-party utilities

If standard interfaces do not give the desired result, you can use the ADB debugging tool (Android Debug Bridge). This method requires connecting your smartphone to your computer and having basic knowledge of the command line. It allows you to send commands to the system that are not available through the normal settings menu.

One ​​useful command is to set the power saving mode for a specific package to "none" (absent). This removes all restrictions imposed by the Doze system. The command looks like this:

adb shell dumpsys deviceidle whitelist +com.example.package

Instead com.example.package you need to substitute the real name of the application package, which can be found through special utilities or in the “For Developers” menu in the “Running Services” section. This method adds the application to the system Idle mode whitelist, ensuring that it will not be frozen even if the device is idle for a long time.

⚠️ Warning: Using ADB commands requires caution. Entering commands incorrectly or changing system parameters can lead to unstable operation of the device. Always check the package name before entering the command.

There are also third-party applications from the Google Play store, such as Hail or Servicelythat automate the setup process. They can emulate clicks to keep applications in memory or use accessibility rights to prevent processes from being killed. However, the use of such utilities itself consumes additional resources.

💡

The combination of disabling battery optimization, setting autorun in the proprietary shell and adding to the Doze white list via ADB gives a 100% guarantee that the application will work in the background.

The impact of settings on autonomy and stability

Allowing applications work without restrictions, you take responsibility for monitoring their activity. An application that does not close continues to use GPS, microphone, network, or processor. This inevitably leads to accelerated battery drain. It is important to monitor battery consumption statistics after making changes.

If you notice that your phone has started to drain within a few hours, check to see if any application is stuck in an error loop. Sometimes a app tries to perform an action that it cannot complete (for example, downloading a file when there is no network), and constantly wakes up the processor. In such cases, it is better to return the optimization settings for that specific application.

It is also worth remembering that operating systems are updated. Google and device manufacturers are constantly changing memory algorithms in new versions of Android. What worked on Android 11 may behave differently on Android 14. Check your settings regularly after major firmware updates.

⚠️ Attention: Settings interfaces and menu item names may vary depending on the Android version and device model. If you don't see the option listed, search Settings using the keyword "battery" or "accessibility."

Ultimately, finding the balance between performance and runtime is an individual process. For some users, 24/7 operation of the navigator is critical, for others it is more important that the phone survive until the evening. Setting exceptions allows you to flexibly manage this balance to suit your needs.

Frequently asked questions (FAQ)

Why does the application close even after disabling battery optimization?

Most likely, your device uses an aggressive proprietary shell (MIUI, ColorOS, etc.). Check the Autorun and Launch Control settings in the manufacturer's proprietary security utilities. Also make sure that in developer mode there is no limit on the number of background processes.

Is it safe to set “No restrictions” for all applications?

Technically it is safe for the system, but it is highly not recommended for autonomy. If all applications run in the background without restrictions, the battery will drain very quickly. Configure this setting selectively only for those apps that you really need to run all the time.

How to find the application package name for the ADB command?

The package name can be found in the Google Play store in the browser's address bar (the part after id=). There are also ID apps, such as Package Name Viewerthat show this information directly on the smartphone.

Are these settings reset when you reboot the phone?

No, battery optimization settings, autorun permissions, and developer mode settings are retained after a reboot. They are reset only when the device is completely reset to factory settings (Factory Reset).

Can banning closing applications speed up the operation of a smartphone?

Usually it’s the other way around. Keeping many applications in memory can lead to a lack of random access memory (RAM), which will cause the interface to slow down. However, for specific heavy-duty tasks (such as rendering a video in the background), this can prevent the process from crashing.