1

I'm using a WebView in an app and I have disabled the cache with these two lines:

mWebView.getSettings().setAppCacheEnabled(false);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

When the app loads the WebView it shows a login page and the strange behavior here is that the page is remembering the user after his first log in (despite the two lines being added). Another relevant point is that if I delete the app data the user is not remembered any more.

So, where is this user being saved? How can I prevent this info from being saved? As I understand it's not being saved in the cache, as I have disabled it.

EDIT: Just to clarify I don't want to remove the data, what I need is that the app does not generate it.

popirey
  • 31
  • 5

1 Answers1

0

It happened the same to me, and it was not the Cache it was Cookie problem, to delete it I did

CookieSyncManager.createInstance(this);         
CookieManager cookieManager = CookieManager.getInstance();        
cookieManager.removeAllCookie();

Also you can take a look on WebStorage.getInstance().deleteAllData();

Reference : How to clear all WebView stored information?

Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
  • Thanks but I have just tried it and it still remembers the user :( – popirey Feb 03 '20 at 15:57
  • Let me get the context, so you have an app with a webview when you log in and uninstall the app the name reminds there? – Skizo-ozᴉʞS ツ Feb 03 '20 at 16:01
  • Not exactly, if I uninstall it the user is also removed, but if I use the lines above to disable the cache and clean the cookies the log in page (inside the webview) remembers the user. However if I remove the app data in the settings the user is removed. – popirey Feb 03 '20 at 16:21
  • @popirey Have you solved this? In order to help other people if this helped you feel free to upvote and mark this as a correct answer. Thanks :) – Skizo-ozᴉʞS ツ Jun 28 '21 at 13:39