How to set cookie in Android WebView
01:02 29 May 2013

I am facing issues with setting cookie in Android WebView. I am using the following code:

CookieSyncManager.createInstance(this); 
CookieManager cookieManager = CookieManager.getInstance(); 
cookieManager.removeAllCookie();    
cookieManager.setAcceptCookie(true);
cookieManager.setCookie(url, cookie); 
CookieSyncManager.getInstance().sync();

But it's not working. I also tried by adding headers using WebView's loadUrl(String url, Map additionalHttpHeaders) method; but still it's not working. Is there a way to do this?

android android-webview android-websettings