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 需要每次设置一项, 设置多个的话,个别机型会无法识别