Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I once read about an init.d tweak to keep an app in memory. I'm unable to find that tweak now. Does anyone have the link? An alternate method would also be welcome.

Edit : I'm using cyanogenmod 10.

share|improve this question
    
Cyanogen has an option to keep the current launcher pinned to memory (check the CM-menues if that is what you're looking for) -- but I don't know about any option to do that for any other app. –  Izzy Aug 24 '12 at 13:55
add comment

1 Answer

up vote 4 down vote accepted

You can do it according to this post on XDA:

  1. Make a file called 99applock.txt
  2. Insert code below and put you messaging service in where it says PPID (that usually can be found in data/data if your using aftermakrket sms app) remove the .txt extension and put file in ect/init.d and just give it 777 permissions, it works for me.
    #!/system/bin/sh

    sleep 60

    PPID=$(pidof com.your.app)
    echo "-17" > /proc/$PPID/oom_adj
    renice -18 $PPID
share|improve this answer
    
Does that only work if the app is started within that 60s sleep period -- or is this init script run repeatedly? I don't see a loop or anything indicating that this would also work for an app started at a later time. –  Izzy Sep 4 '12 at 20:00
    
There must be a catch with this? Surely, keeping it in memory will starve other apps of precious RAM and could cause Android to go berserk when trying to manage apps that hit the memory threshold and quite potentially p-off users who are wondering why the app is not loading when that threshold gets reached! –  t0mm13b Jan 31 '13 at 17:03
    
This seems to work well... at first. but if i watch the oom_adj file i find that pretty soon it is no longer -17, and then my app can be killed again –  Michael Sep 19 '13 at 22:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.