Hi,
I develop an app that is very content centered. Content consists mostly of
html pages (its basically an app version of an existing homepage with some
added features like GPS and camera), so most of the app will just run inside
a webview.
The app is intended to be used mostly offline, though, so I need good
caching mechanisms.

Any ideas how to handle the caching? Basically I would need to check wether
a html page and all pictures are already on the device and only load them
otherwise.
Do I need to parse the html for the links to the pictures or are there
better ways to handle this?

HTML 5 caching seems to work, but I don't feel that I am in control. For
instance: The webview does react to my .manifest file - but caches pages
that are not contained there too.
Using this code, my pages are cached:

webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);

webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReachedMaxAppCacheSize(long spaceNeeded, long totalUsedQuota,
WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(spaceNeeded * 2);
}
});

webView.getSettings().setDomStorageEnabled(true);

// Set cache size to 8 mb by default. should be more than enough
webView.getSettings().setAppCacheMaxSize(1024 * 1024 * 8);


Thanks,
Stephan
-- 
Interessiert an Android?
http://android-schweiz.blogspot.com/
Whant to learn German?
http://german-podcast.blogspot.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to