Android: Determine when app is being finalized
- by Matt
Hi all, I posted a question yesterday about determining when an app is being finalized vs destroyed for screen orientation change. Thanks to the answers I received I was able to resolve my problem with the screen orientation change. However, I am still running into a roadblock.
This app I am working on logs into a website with an HttpClient. As long as the app remains in memory the HttpClient will retain the cookies from logging in. However, once it is killed, it would need to log in again.
My question: How can I determine when the app is being killed from memory so I can set a boolean to false telling the app it has been removed from memory so the next time it starts it will read this and determine is must log in again? Or is it possible to serialize an HttpClient and put that in the savedInstanceState bundle? May extract the cookies from the client and put those in the savedInstanceState bundle? Is there something I'm completely missing here maybe?
Any help or a point in the right direction is greatly appreciated because this one has me stumped. Thank you!