Ordinarily, Android's process lifecycle is a great thing. Rather than allowing apps to keep running indefinitely, the process lifecycle defines what happens to old processes as the system is in need of new memory for newer and more important apps. This behavior is generally a good thing, unless one of the apps that is killed happens to be an app that you would like to have stay open.

There are a few ways that applications can get around this. For example, if an application places an ongoing notification in the notification bar, it will stay in the foreground and won't be automatically killed. However, what if you wish to preserve other applications?

Luckily, XDA Senior Member defim created KeepRunning for exactly this purpose. While the application won't prevent your applications from being killed, KeepRunning monitors your apps and restarts up to three applications of your choosing at a user-specified monitor interval. This is quite useful for crash-prone messenger apps, which may otherwise miss messages while not open.

Head over to the application thread to get started.