Issue
I recently logged into Microsoft WAAD account using an webview, on further opening of the app again for testing i do not see the login page of Microsoft however i would be taken to next page after login directly.
i tried these things:
webView.clearCache(true);
webView.clearFormData();
webView.clearHistory();
webView.clearSslPreferences();
getApplicationContext().deleteDatabase("webview.db");
getApplicationContext().deleteDatabase("webviewCache.db");
getBaseContext().deleteDatabase("webview.db");
getBaseContext().deleteDatabase("webviewCache.db");
but my issue is not yet solved. anything else to be done ?
Regards.
Solution
You did everything okay, but you need to delete the cookies as well
CookieSyncManager.createInstance(getActivity());
CookieManager cookieManager = CookieManager.getInstance();
if(Build.VERSION.SDK_INT >= 21) {
cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean aBoolean) {
}
});
}
else{
cookieManager.removeAllCookie();
}
This is how you would disable them alltogether
CookieSyncManager.createInstance(getActivity());
CookieManager cookieManager = CookieManager.getInstance();
if(Build.VERSION.SDK_INT >= 21) {
cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean aBoolean) {
}
});
}
else{
cookieManager.removeAllCookie();
}
cookieManager.setAcceptCookie(false);
WebView webview = new WebView(getActivity());
WebSettings ws = webview.getSettings();
ws.setSaveFormData(false);
ws.setSavePassword(false); // Not needed for API level 18 or greater (deprecated)
Answered By - Bojan Kseneman
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.