How Can I add Cookies support ?
shijilt opened this issue · comments
How can I store cookies in WebView ? I am using following android application source to load a website. But it seems to be not keeping the cookies on exit. How can I save cookies for 30 or 60 days ?
CookieManager.getInstance() is the CookieManager instance for your entire application. Hence, you enable or disable cookies for all the webviews in your application.
Normally it should work if your webview is already initialized: http://developer.android.com/reference/android/webkit/CookieManager.html#getInstance()
Maybe you call
CookieManager.getInstance().setAcceptCookie(true);
if (android.os.Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
} else {
CookieManager.getInstance().setAcceptCookie(true);
}