0

I have an app that runs a Webview Activity, and my server's web framework handles user authentication (logins) by storing a session token in a cookie. I have my app running on 4 devices: An Android 2.2.1 (A), Android 2.3.6 (B), an Android 2.3.7 (C), and an Android 4.0.3 (D). For Androids (A), (B), and (D), the Webview stays logged in even after previous Activity Destorys, indicating that cookies are saved for the WebView automatically. However, for Android (C), cookies don't appear to be stored for the WebView, because I am asked to log in again after a previous Activity Destroy. If this happens in one of my devices, it can surely happen in other devices as well. I want to learn how I can force WebViews to always save cookies.

TL;DR How do I force WebViews to always store cookies? OR how do I handle WebView cookie storage/retrieval myself?

user1408996
  • 117
  • 3
  • 9
  • 1
    Are you using http://developer.android.com/reference/android/webkit/CookieManager.html? – David Chandler Jun 01 '12 at 18:46
  • No my code did not use cookie manager, maybe that's why I have this problem? – user1408996 Jun 01 '12 at 21:48
  • 2
    Not necessarily. I was just looking for a complete problem statement. Other SO posts like http://stackoverflow.com/questions/1652850/android-webview-cookie-problem suggest a wide variety of potential issues / solutions. I would start by trying CookieManager.getInstance().setAcceptCookie(true). – David Chandler Jun 04 '12 at 22:19

0 Answers0