Clearing all cached items created by a WebView?

后端 未结 3 1491
借酒劲吻你
借酒劲吻你 2021-01-05 01:16

I\'ve got a WebView in my app. When the user logs out of my app, I\'d like to delete all cached resources the WebView may have created. Looking at an emulator, I see the fol

3条回答
  •  误落风尘
    2021-01-05 01:43

    This is the only code that saved my day!!

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

    My scenario:

    • Once logged in via linkedIn with the webview. The webview saves the login details. I need my app to clear this when the user signs out of the application. All the other approaches did not work for me.

提交回复
热议问题