Hello I tried to cache my web application with my android device. I tried everything but nothing will work. The Cache will not refresh only on android devices and not on other devices! Below you see all the settings I've set to cache the web application.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
web = (WebView) findViewById(R.id.webview);
web.setWebViewClient(new myWebClient());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setCacheMode(web.getSettings().LOAD_NORMAL);
web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
web.getSettings().setUserAgentString(getString(R.string.user_agent_suffix));
web.getSettings().setAppCachePath("http://192.168.0.62/lastversion/cache.manifest");
web.getSettings().setAllowFileAccess(true);
web.getSettings().setAppCacheEnabled(true);
web.getSettings().setDomStorageEnabled(true);
web.loadUrl("http://192.168.0.62/lastversion/");
}
here I set my cache:
I hope someone can help me. Thanks
解决方案
web.getSettings().setAppCachePath() set's the local directory where to store the cached files not where to load the manifest from.
The manifest has to be referenced in the HTML file you want to cache: