Last active
August 29, 2015 14:02
-
-
Save jwill/6e10a96fb5cfde9dd3a3 to your computer and use it in GitHub Desktop.
t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As you were moving around between apps, you probably noticed that from a *user* perspective, Android doesn’t announce changes in app state, it doesn’t announce that it’s low in memory, or ask users to close apps to free up resources. In fact, it does everything it can to make the resource limitations of the device invisible to the user. | |
That means keeping the foreground app running smoothly, and switching between apps seamless -- and that means killing apps in the background (remove background app layers) if it needs their resources to make that happen. | |
So, we know that as soon as your app isn’t visible, it’s lifetime is as perilous as that of a Stark at the Red Wedding -- likely to die without notice (but ready to return from the dead). That tells us some very important things about how our apps should behave to be good citizens, and provide a great user experience. | |
From a system perspective, onPause and onStop are signals that our app may be killed imminently, so we need to clean up any resources that need an orderly teardown -- such as closing any open connections or sockets. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment