'Android SDK Over 21 Java WebView doesn't the store cookie
My application is using SDK over 21. It doesn't store the cookie for request next api.
wvMain.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
wvMain.getSettings().setSupportMultipleWindows(false);
wvMain.getSettings().setJavaScriptEnabled(true);
wvMain.getSettings().setDomStorageEnabled(true);
wvMain.getSettings().setAppCacheEnabled(true);
wvMain.getSettings().setDisplayZoomControls(false);
wvMain.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
wvMain.getSettings().setAllowContentAccess(true);
wvMain.getSettings().setAllowFileAccess(true);
wvMain.setLayerType(View.LAYER_TYPE_HARDWARE, null);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.flush();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
wvMain.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
CookieManager.setAcceptFileSchemeCookies(true);
cookieManager.setAcceptThirdPartyCookies(wvMain, true);
}
cookieManager.setAcceptCookie(true);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
