Home > other >  on android webview avoid or block unexpected open help center for cookies
on android webview avoid or block unexpected open help center for cookies

Time:12-16

i have development a android app with web view but sometimes it opens the help center for cookies:

enter image description here

this is my configuration:

webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webSettings.setGeolocationEnabled(true);
webSettings.setSaveFormData(true);

how can i prevent this from happening?

CodePudding user response:

Add this line after initialize your webview

CookieManager.getInstance().setAcceptCookie(true);
  • Related