When connected to the server i get the Cookies and store them in a List.
While making connections later i add these cookies to the DefaultHttpClient.
The problem is, when the Application is in background for sometime, all the class data is being lost including the DefaultHttpClient.
Hence i am losing the cookie.
Is there a way to keep the DefaultHttpClient alive forever?
or any better way to store and use cookies?
Thank You
Get it from the cookie, then save it in the shared prefferences when the app is killed (e.g. onStop method). Then reload it on onCreate(). Something similar to this:
(I have omited the code for getting and setting the cookie, I assume that’s not a problem)