Android HttpClient Cookie

Android HttpClient是否具有cookie的自动pipe理function?

Solutions Collecting From Web of "Android HttpClient Cookie"

它支持它。

阅读下面的post,似乎你必须在调用execute时传递相同的HttpContext。

response = httpClient.execute(httpPost,localContext); 

究竟该怎么做是在这篇文章中: Android项目使用httpclient – > http.client(apache),post / get方法

如何在Android和/或Java中使用HttpClientpipe理Cookie?

您可以将其设置为静态,并在所有请求中使用它

 client = new OkHttpClient(); // client will be static and use in all requests CookieManager cookieManager = new CookieManager(); cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); client.setCookieHandler(cookieManager);