Handling Session Cookie in Android Volley
For those unfamilar with Volley its a networking library and,it will switch its http request client from HttpUrlConnection or HttpClient depending on android version, so one thing I need to know is how to add cookie support to each of these client types. How do I opt in to session management for both types of clients?
I have seen this solution: Using cookies with Android volley library
which is a good step in the right direction. Has anyone found a way to push this logic a level down into the library without using preferences? or references from Volley into the application. I don't mind rewriting the Volley helper class to apply some support for this but not sure if both types of http clients support cookies and what exactly I would need to do to turn on cookie support?
also is there a way to use Volley with CookieManager perhaps?
Take a look at my answer on the other question you linked. By specifying the HttpClient for Volley to use, it will only ever use that one for connections. Thus obviating the need to set cookies on both.
For handling session cookies, I use CookieManager and a own implementation of CookieStore. Here I show a implementation of this, storing the cookie in SharedPreferences
链接地址: http://www.djcxy.com/p/15420.html