Android WebView cache not expiring

in my android app I am using WebView and faced caching issue. After caching the file, the WebView just keeps it forever (or at least until I manually delete the cache).

In the Apache Access-Log, I see that the WebView does not send requests after the file has been cached. How can I configure WebView to send validation requests if a file has expired using generic ETags and a 304 HTTP code? In desktop browser (Firefox, Chrome), caching works as expected.

Here is my code:

    webView = (WebView) findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.setWebViewClient(new EWebViewClient(this));
    webView.getSettings().setBuiltInZoomControls(false);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
    webView.setWebChromeClient(new EWebChromeClient(this));
    webView.setBackgroundColor(Color.argb(1,0,0,0));
    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    webView.loadUrl(url);

      

EWebViewClient only overwrites: "shouldOverrideUrlLoading, onPageFinished, onLoadResource, onReceivedError"

I really appreciate any help you can provide.

+3
android caching webview etag if-modified-since


source to share


No one has answered this question yet

See similar questions:

86
Android Webview - Clear Cache Completely
8
How to enable expires-header caching for webview

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2097
Is there a way to run Python on Android?
1858
"Debug certificate expired" error in Android Eclipse plugins
1554
Disable Chrome cache for website development
1398
How do we control web page caching in all browsers?
0
how to add webview to scrollable tabs?



All Articles
Loading...
X
Show
Funny
Dev
Pics