【发布时间】:2012-06-04 10:13:53
【问题描述】:
cookie 总是返回 null...
在 android 2.x 中这很好用,但 4.0.4 ICS 不适用
ConnectivityManager manager = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
CookieManager cookie = CookieManager.getInstance();
if(cookie.getCookie(mContext.getString(R.string.host_url))!=null){
conn.setRequestProperty("Cookie", cookie.getCookie(mContext.getString(R.string.host_url)));
Log.d("tag", "cookie get " + cookie.getCookie(mContext.getString(R.string.host_url)));
}
在这段代码中 cookie.getCookie() 总是返回 null...
*在 HttpUrlConnection 中使用此代码
【问题讨论】:
标签: android cookies session-cookies android-4.0-ice-cream-sandwich httpurlconnection