标签: getCookies

android service操作getCookies报错

解决方案是在getCookies之前执行下面语句 CookieSyncManager.createInstance(context); 很奇怪的是在activity中不需要执行这句也能获取cookie 查看官网文档,CookiesSyncManager已经不推荐使用了, 原话如下: This class was deprecated in API level 21. The WebView now automatically syncs cookies as necessary. You no longer need to create or use the CookieSyncManager. To manually force a sync you can use the CookieManager method flush() which is a synchronous