Reputation: 811
I have a Service for my Android app that performs HTTP calls. The Service stores cookies in a CookieStore. I am trying to find a way to persist the CookieStore but I haven't been successful. I don't want the user to log in every time to receive a new CookieStore.
I tried to use SharedPreferences to store the CookieStore as a string, but I can't re-construct the CookieStore with a String.
Has anyone else had success in persisting a CookieStore?
Upvotes: 7
Views: 3643
Reputation: 1006724
You can create your own CookieStore
implementation. Bear in mind that HttpClient isn't an Android-specific technology, so you will find some documentation over at the Apache site (see section 3.7).
Upvotes: 2
Reputation: 6517
There is a nice library for handling various aspects of http requests, among them persisting cookies in the shared preferences: http://loopj.com/android-async-http/
(you can use the full lib or just the the two classes needed for cookie persistence)
Upvotes: 7