We have a web application that makes use of the HTML 5 application cache to provide offline functionality. On Android
the application runs inside a webview
in a native application. We have tested the application in version 4.4
and it works correctly. We can shut down the application, turn off the Wifi
and restart the application, and the web app loads correctly from the application cache.
However, on earlier version of Android, notably version 4.0 and 4.1 (I have not yet tested 4.2 or 4.3), the application cache seems to get corrupted at some point. One of the symptoms that we noticed is that the application events get stuck in the Checking
state and no other application cache events are fired.
Here is a link that I found where this issue is reported:
https://code.google.com/p/chromium/issues/detail?id=258191
We are not sure what triggers this issue of the events getting stuck, but we have worked around it for now by not using any blocking popups in the application cache events. And we have found that as long as the application cache being stuck in Checking
state does not block the UI, the application will continue to work normally.
But if we close the application and restart it, then the application cache gets corrupted and the html does not load correctly (the webview shows a blank screen). The only thing that helps in this situation is to either manually clear the cache or reinstall the application so that the cache gets reloaded at startup. This is obviously not an acceptable work around for our clients and we don't want to force them to do a clear cache before launching the application. We are looking at programmatically clearing the application cache, either when the application closes or when it launches, but this workaround is also less than ideal because it would mean that if the client closes the application when no internet connection is available, they would not be able to launch it and continue working.
We need to work around this issue somehow because some of our clients have devices with Android 4.0
and are not able to upgrade to the newest version. If anyone has had experience with this issue of the application cache getting corrupted on closing the application, then we will gladly hear any workarounds that you may have found for this issue.
Although we have this workaround, it is definitely less than ideal and we would prefer to know of any other workarounds that other people may have found to this problem.
UPDATE:
I have struck out the text dealing with the application cache getting corrupt as I have researched this issue further and determined that what we are experiencing is not caused by the application cache getting corrupted. What we are seeing is the effect of a (possibly related) bug where AJAX requests stop working. I have posted about this in a separate question which can be found here. By striking out this text I have changed this question to deal only with the issue of the application events that seem to hang in the CHECKING state.