how to Remove/Delete specific cookie programmatically in android?

旧城冷巷雨未停 提交于 2020-01-13 17:11:28

问题


I want to call web service , it needs to delete specific cookie before calling web service, i want code to remove or delete specific cookie in android.

I have Url which i want to delete cookie.


回答1:


You can try CookieManager.setCookie() and set the cookie to the empty string like that:

String cookieVal = "yourCookie=''";
cookieManager.setCookie(cookieDomain, cookieVal);

You can also expire cookie like that:

String cookieVal = "yourCookie=;expires=Sun, 31 Dec 2015 00:00:00 UTC;";


来源:https://stackoverflow.com/questions/34488255/how-to-remove-delete-specific-cookie-programmatically-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!