Reputation: 397
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.
Upvotes: 3
Views: 4174
Reputation: 16117
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;";
Upvotes: 6