我想调用 web 服务,它需要在调用 web 服务之前删除特定的 cookie,我想要代码在 android 中删除或删除特定的 cookie。
我有要删除 cookie 的 Url。
最佳答案
您可以尝试 CookieManager.setCookie()
并将 cookie 设置为空字符串,如下所示:
String cookieVal = "yourCookie=''";
cookieManager.setCookie(cookieDomain, cookieVal);
您也可以像这样使 cookie 过期:
String cookieVal = "yourCookie=;expires=Sun, 31 Dec 2015 00:00:00 UTC;";
关于android - 如何在 android 中以编程方式删除/删除特定的 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34488255/