I am trying to use the application cache to validate performance.
I was guided on different sites. (e.g. http://xguru.net/621 ...)
create a cache.man file, set the mime type as text / cache-manifest.
The problem is that...
It works well in Chrome Chrome browser, but does not work on my Android phone.
I tested ICS and Gingerbread.
This is a manifest file.
CACHE MANIFEST
and then I set my webview as follows.
getSettings().setAppCacheEnabled(true); getSettings().setDomStorageEnabled(true); getSettings().setPluginsEnabled(true); getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
(I changed cacheMode to LOAD_NORMAL, NO_CACHE, but it is no different.)
To see the status of the cache, I use this site. http://jonathanstark.com/blog/2009/09/27/debugging-html-5-offline-application-cache/
var cacheStatusValues = []; cacheStatusValues[0] = 'uncached'; cacheStatusValues[1] = 'idle'; cacheStatusValues[2] = 'checking'; cacheStatusValues[3] = 'downloading'; cacheStatusValues[4] = 'updateready'; cacheStatusValues[5] = 'obsolete'; var cache = window.applicationCache; cache.addEventListener('cached', logEvent, false); cache.addEventListener('checking', logEvent, false); cache.addEventListener('downloading', logEvent, false); cache.addEventListener('error', logEvent, false); cache.addEventListener('noupdate', logEvent, false); cache.addEventListener('obsolete', logEvent, false); cache.addEventListener('progress', logEvent, false); cache.addEventListener('updateready', logEvent, false); function logEvent(e) { var online, status, type, message; online = (navigator.onLine) ? 'yes' : 'no'; status = cacheStatusValues[cache.status]; type = e.type; message = 'online: ' + online; message+= ', event: ' + type; message+= ', status: ' + status; if (type == 'error' && navigator.onLine) { message+= ' (prolly a syntax error in manifest)'; } console.log(message); } window.applicationCache.addEventListener( 'updateready', function(){ window.applicationCache.swapCache(); console.log('swap cache has been called'); }, false );
Finally, this is the magazine that I see on my Android phone.
[cache Resource] app cache support! [cache Resource] DOWNLOADING [cache Resource] event online: yes, event: checking, status: uncached [cache Resource] event online: yes, event: downloading, status: uncached [cache Resource] event online: yes, event: progress, status: uncached [cache Resource] event online: yes, event: progress, status: uncached [cache Resource] event online: yes, event: error, status: uncached (prolly a syntax error in manifest)
Images are uploaded, but we get an error in the last line. Therefore, it is always in an inaccessible state.
I assume the problem is with setting up a webview or an Android app. But I can't handle it.
give me advice on using the application cache .. plz ...