3 ms·
While I'm no expert at Android architecture I own an Android phone and I think there are there are two ways an app can run in the background on Android: first,
by DrJokepu 17y ago
While I'm no expert at Android architecture I own an Android phone and I think there are there are two ways an app can run in the background on Android: first, there are the "background services" (or whatever they are called) but my understanding is that there are also six slots of apps that aren't "hybernated" they're just not "focused" - they might not consume any CPU cycles but they're still in the memory. I would axe this second type of background tasks. Correct me if I'm wrong though, I always wondered how it works exactly.
- vetinari 17y agoActually, there is only one way the application can run in background: the "service". The "background slots" are implementation details. Applications do not receive the event "you are going to be killed, please serialize" the same moment they lose focus; they receive it at the system's discretion. The system decides based on memory available (mostly), whether it will leave some processes running or whether they will be "backgrounded" (basically, what is more economical - backgrounding processes all the time, when the user is switching between two apps, or just keep them both in memory?). To some extent, this is tunable by the power users - if they download "Dev Tools", they can set the limit to 1 - 4 processes (or unlimited). It is basically trade off between memory consumption and responsiveness. I repeat - this is not supposed to be setting for common users; it is just exposed for developers to experiment, what happens when they push the decision threshold in one direction or another. The system is supposed to have good default out of the box and manage the processes automatically (which is also reason, why there is no task manager).