Search code examples
androidandroid-lifecyclekill-process

In what circumstances recent apps are killed by Android other than a need for resource?


One of the main reasons that all we know is that Android may need some memory resources or battery saving and decide to do this. BUT what I want to know is:

is there anything else, like time limit, which may make Android kill your process? or anything else?


Solution

  • Is there anything else like time limit which may make android kill your process? or anything else?

    It's meaningless for the system to kill a process recently important to user by a reason other than reclaiming system resources.

    But long running processes (~ 30 minutes which may vary with OS versions) may either

    • be downgraded in their "importance" so that their "chances" to be killed by the system increase
    • or get their task cleared, i.e. "the system clears a task (removes all activities from the stack above the root activity) in certain situations when the user re-selects that task from the home screen. Typically, this is done if the user hasn't visited the task for a certain amount of time, such as 30 minutes." Note that clearing a task is not same as killing an app process!

    P.S. As to your assumption, for a device without "lack of resource or anything", you may (or may not!) observe the task clearing after not visiting the app for ~30 minutes.