As the CookieSyncManager.getInstance().sync();
is deprecated Itried to maintain cookies forever in my application using new command flush() :
webview.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { CookieManager.getInstance().setAcceptCookie(true); CookieManager.getInstance().acceptCookie(); CookieManager.getInstance().acceptThirdPartyCookies(webview); CookieManager.getInstance().flush(); } // and more settings for webview }
But every time I open the app it seems that previous cookies were expired. Do those options help preserving cookies? And Should I put them in onPageFinished
?
Besides I have to say that the cookies are working fine on the target website and are set to live for 100 days. Also minSdkVersion is 21 and targetSdkVersion is 29.
https://stackoverflow.com/questions/65376446/android-webview-cookies-expires-when-exit-app December 20, 2020 at 10:32AM
没有评论:
发表评论