Android how to preserve session information from httpClient after the destruction of the httpClient object?

Friday, July 4, 2014

In my application I log in to the server using DefaultHttpClient httpClient; the session information is stored in this object so for every request I use the same object, otherwise I get a "no authentication" error from the server.

The problem is that I need to be able to perform a server task from a service even when the app is destroyed.

How do I preserve the session information somehow so the Service (actually a WiFi Receiver) context is able to access it and pass it to the new DefaultHttpClient httpClient that I create?