如何在非io线程上从android.webkit.CookieManager中获取cookie?

时间:2014-03-09 22:10:28

标签: android android-webview android-4.4-kitkat webviewclient

我已在shouldInterceptRequest上实施了WebViewClient方法。在那里我使用HttpURLConnection自己加载资源。为此,我必须在URL连接上设置cookie。这对于android 4.3及以下版本都运行良好,但是在kitkat上它会冻结,因为CookieManager.getCookie(url)上存在死锁。此问题记录在此处https://code.google.com/p/android/issues/detail?id=65786

无论如何,我可以在调用shouldInterceptRequest之前读取某个帖子上的cookie,但我需要传递shouldInterceptRequest的网址,所以我不知道该怎么做。是否可以以其他方式为WebView实现cookie保存?

感谢。

1 个答案:

答案 0 :(得分:0)

请参阅我对错误的回复:https://code.google.com/p/android/issues/detail?id=65786#c8。我很想知道这是否有帮助。