I call CookieManager.getInstance().removeAllCookie() in onCreate in my app.
I'm running into a weird issue where I'm seeing an unexpected cookie value get passed up in a GET request. In fact, the cookie value is a really, really old value.
Here are the steps I perform for the test:
- Install the app
- Make a GET request on app launch. Request should be clean: no cookies should be sent up.
- GET request responds with a Set-Cookie. The value is based on the request time, so there's a very small chance this value is the same on any two requests.
- Make another GET request. Request should send up cookie value from step 3.
The first time I installed the app, the cookie behavior worked as I expected above. I uninstalled the app, then re-installed it, and the cookie behavior, again, worked as expected. I do this a few times, things are fine and dandy.
Then, suddenly, on the Nth install, step 2 doesn't pass. The very first GET request isn't clean. In fact, it's comes in with a value that was set on the first install of the app.
I can't reproduce this problem reliably, but I do see it quite often. It's not that the first GET request on install is sending up a cookie value from the immediately previous install -- the value is from three or four previous installs which were all followed by uninstalls.
How is it possible that I'm seeing this? How can I actually remove all of the app's cookies?