本文介绍了HttpClient的不存储在GALAXY S2饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想从这个code

    DefaultHttpClient httpClient = new DefaultHttpClient();
    httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT);
    HttpRequestRetryHandler retryhandler = new DefaultHttpRequestRetryHandler(6, true);

    httpClient.setHttpRequestRetryHandler(retryhandler);

    BasicCookieStore cookieStore = new BasicCookieStore();
    httpClient.setCookieStore(cookieStore);
    if(Build.VERSION.SDK_INT>8){
        CookieManager cookieManager = new CookieManager();
        cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
        CookieHandler.setDefault(cookieManager);
    }
    HttpGet httpget = new HttpGet(URL);
        HttpResponse response = httpClient.execute(httpget);


    HttpEntity entity = response.getEntity();
...

它的正常工作与所有我试过到目前为止,除了三星Galaxy SII我的客户端(安卓4.0.3)的设备。来自服务器的响应,这似乎是会话Cookie不保存。我无法重现此错误,一切我试过到目前为止并没有解决这个问题。你有什么线索吗?

It's working fine with all the devices I tried so far except the Samsung Galaxy SII (android 4.0.3) of my client. From the server response, it seems like the session cookies are not stored. I failed to reproduce this bug and everything I tried so far didn't solve it. Do you have any clue ?

编辑:删除了code谁被禁用StrictMode政策(仍然有问题寿),一个集团

removed a bloc of code who was disabling the StrictMode policy (still having the issue tho)

推荐答案

我也有类似的问题。问题的事实是,我的手机是造成不正确的日期,以便所有的cookies是空的!

I had a similar problem. The problem was the fact that my phone was causing incorrect date so that all cookies were empty !!!

这篇关于HttpClient的不存储在GALAXY S2饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 16:34