I am not challenging Android's memory management technique (like killers do). I just want to give an app higher priority even when it's not in foreground or visible (with notification).

AutoKiller Memory Optimizer is able to do it on rooted device, but the change lasts for few seconds if I multi-task.

I want to do this permanently: perhaps running a background daemon to do change continuously should work. How to do this?

  • Same problem here. You can use v6 supercharger for a partial fix to your problems. Commented Aug 4, 2012 at 20:57
  • You could ask the developer to add an (optional) service with the app. Apps having a service connected are less likely to get killed by OOM.
    – Izzy
    Commented Aug 4, 2012 at 23:05
  • 1
    @Izzy Priority of apps having services is lower than foreground & visible ones. BTW, how many developers you are suggesting me to calculate? Its not a solution...
    – iOS
    Commented Aug 5, 2012 at 19:58
  • @SachinShekhar you are right, but with a running service the prio is still higher than that of other "background apps", as far as I remember. And as far as I understood, you where concerned for one specific app -- so I'd suggest that specific developer :) But OK, it was just a suggestion. Sorry it's no help to you -- was worth a try, though.
    – Izzy
    Commented Aug 5, 2012 at 20:10
  • Did you check Keeping an app in memory? Looks like that would answer your question.
    – Izzy
    Commented Aug 27, 2012 at 9:42

3 Answers 3


On XDA I found a post discussing how to PIN an app to not get killed by OOM. As your question indicates your device is rooted, this could be useful for you. The principle described there can be applied to your case as well by simply changing the oom_adj value specified (the -17 would permanently PIN it, highest prio -- so use a larger value to "weaken" that).

The script snipped posted there looks like this:

sleep 60

PPID=$(pidof com.estrongs.android.safer)
echo "-17" > /proc/$PPID/oom_adj

An anonymous user noted you could also set this file to read-only permissions to prevent Android from updating it, adding chmod 444 /proc/$PPID/oom_adj to the above script (the proposed 444 means nothing but read permission, but doesn't affect the system's ability to remove the file when the process ends). I have not verified that, but this could in fact save you from looping/repeatedly running the script, making the set value permanent for as long as the process lives.

As said, replace the -17 by your chosen value. Also replace the app's package name (com.estrongs.android.safer) by the package name of your target app. You can also lower the sleep value, or even ommit the sleep at all.

Now you need a way to auto-execute this as soon as your app is running. For this part, you could e.g. use Tasker: Context would be "app running" (and your app selected), and the task "run shell", with above script as parameter. Then, as soon as you start your app (and it comes to foreground), Tasker would execute the script -- and the oom_adj value should be applied.

  • i notice that if i background the app, the oom_adj value changes. does this mean that the app has actually been unpinned?
    – Michael
    Commented Sep 19, 2013 at 22:05

It can't be done from a application's code (background service or thread or whatever). Reason is well described in this post, http://debuggingisfun.blogspot.com/2014/03/android-foolproof-low-memory-killer.html

  • Welcome to Android Enthusiasts! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Commented Mar 16, 2014 at 10:52

ROM Toolbox Pro by Jrummy has built-in OOM manager.

  • 1
    That's similar to AutoKiller Memory Optimizer.. Read the question again..
    – iOS
    Commented Mar 8, 2013 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .