CookieManager和CookieSyncManager不同步饼干ICS​​到的WebView(适用于所有的previous API级别) [英] CookieManager and CookieSyncManager not syncing cookies to webview in ICS (works on all previous API levels)

查看:179
本文介绍了CookieManager和CookieSyncManager不同步饼干ICS​​到的WebView(适用于所有的previous API级别)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我通过我的应用程序acquireing饼干,并利用它们在内部通过请求HTTP。用户可以切换到的WebView任何给定的时间,在这种情况下,我同步/注射cookies来 web视图

I'm acquireing cookies through my app and use them internally by making requests to http. Users can switch to webview any given time, in which case I sync/inject cookies to webView.

$ C $下同步饼干使用到的WebView <一个href="http://developer.android.com/reference/android/webkit/CookieSyncManager.html">CookieSyncManager:

Code for synchronizing cookies to webview using CookieSyncManager:

CookieSyncManager.createInstance(a);
CookieManager cm = CookieManager.getInstance();
cm.setCookie(domain, cookieName + "=" + cookieValue);
CookieSyncManager.getInstance().sync();

这适用于所有 API级别的除了 API 15+(安卓4.0冰淇淋三明治)。该 CookieManager API不是去precated。

This works on all API levels except API 15+ (Android 4.0, Ice Cream Sandwich). The CookieManager API is not deprecated.

是什么原因造成这个问题,有什么解决方法?

What is causing this problem and are there any workarounds?

推荐答案

您可以尝试在Apache DefaultHttpClient做这个工作对你来说,我不认为这是在冰淇淋三明治改变。

You can try the Apache DefaultHttpClient to do this work for you, I don't think it been changed in Ice Cream Sandwich.

我发现这个样品,但有很多更此处

I found this sample, but there is lots more in here

这篇关于CookieManager和CookieSyncManager不同步饼干ICS​​到的WebView(适用于所有的previous API级别)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆