How to enable cookies in android webview?

You should consider that

CookieManager.getInstance().setAcceptCookie(true);

doesn’t work from lollipop(API21) and above. You should check and use appropriate function for that case:

if (android.os.Build.VERSION.SDK_INT >= 21) {   
     CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
} else {
     CookieManager.getInstance().setAcceptCookie(true);
}

Leave a Comment