I'm trying to find the official documentation about the Android
Application
class lifecycle. Apparently, for what I found on StackOverflow here and here the Application class can be killed if the system needs memory. Even this tutorial says so.
But few things irritates me a bit about this:
- I can't find an official documentation telling me that yes, the
Application
class can be killed on low memory. - I can't find any official diagram representing the
Application
lifecycle neither. - I can't find any proper callback to use when the
Application
class is killed exceptonLowMemory()
. Does it mean that I have to use this method to persist my data? - If the
Application
class is killed on low memory pressure and the app comes to foreground again, how can I know in itsonCreate()
that the app has been recreated after a system kill? In anActivity
I would test thesavedInstanceState
, but as far as I know there is nothing similar in theApplication
class.
Thank you for your enlightenments.