Android : What does system-initiated process death mean?

1.5k Views Asked by At

I am looking at the https://developer.android.com/topic/libraries/architecture/saving-states. It mention of "system-initiated process death". What does it actually mean?

1

There are 1 best solutions below

2
CommonsWare On

Quoting the documentation:

In most cases, every Android application runs in its own Linux process. This process is created for the application when some of its code needs to be run, and will remain running until it is no longer needed and the system needs to reclaim its memory for use by other applications.

(emphasis added)

If your app is not in the foreground, the system can terminate your process at any point to free up system RAM for use by other processes. The page that you linked to has information about saving activity states for a short while (via onSaveInstanceState()), in case the user happens to return to your app fairly quickly, yet Android terminated your process in the meantime.