码迷,mamicode.com
首页 > 移动开发 > 详细

android webview setcookie 设置cookie

时间:2015-05-06 17:09:00      阅读:524      评论:0      收藏:0      [点我收藏+]

标签:

CookieSyncManager.createInstance(mWebView.getContext());
CookieManager cookieManager = CookieManager.getInstance();
<br>        //如果使用cookie.setCookie(DOMAIN,String.format("version=%s; domain=%s",mApp.getVersionCode,DOMAIN))<br>     //在某些机型上getCookie会返回null
cookieManager.setCookie(DOMAIN, String.format("version=%s", mApp.getVersionCode()));
cookieManager.setCookie(DOMAIN, "read_app=android");
cookieManager.setCookie(DOMAIN, String.format("domain=%s", DOMAIN));
 
CookieSyncManager.getInstance().sync();
Logger.d(TAG, String.format("get cookie info %s", cookieManager.getCookie(DOMAIN)));

setcookies 需要每次设置一项, 设置多个的话,个别机型会无法识别

android webview setcookie 设置cookie

标签:

原文地址:http://www.cnblogs.com/duanweishi/p/4482337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!