CookieManager和CookieSyncManager不同步饼干ICS​​到的WebView(适用于所有的previous API级别)有的、适用于、饼干、级别

2023-09-04 11:05:38 作者:女人就得拽 不然就被甩

背景:

我通过我的应用程序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 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

 
精彩推荐
图片推荐