I am using the simplest way to maintain sessions, which is:
Just create 1 HttpClient and use it for every server call, which will automatically handle cookies etc..,
But the problem here is, when i close the application, the HttpClient object is being destroyed, as expected and hence i cannot login.
So i fixed it, this way:
Store user-email and password in shared preferences, every time the application is launched make a call to the login function(this creates a new session) and use the same HttpClient.
The problem here is, every session in the web server has an expiry duration of 3 years. Where as i am creating a session (Since i am calling login every time user launches the app), every time user launches the app. Which causes session duplication or say unnecessary sessions being created on the server side.
Am i doing it the right way? How can i solve this?
Thank You