Search code examples
androidhtmlandroid-webviewhtml5-appcache

Android WebView Application Clears HTML5 cached data on Force Close/Reboot


I have one sample application which has WebView supporting html5 features, i have one website which stores offline data and retrieves offline stored data, but whenever i force close the application it looses all saved data.

Is there anything extra ordinary i am suppose to do to handle force close?

Thanks in advance :)


Solution

  • I too had this problem and found this strange behavior of Activity and WebView:

    If you have more than 1 web views declared in your layout xml, force close/reboot will not persist cached offline data.

    So solve this issue, I kept only 1 web view in the layout xml and other web views I added dynamically into view group. This prevent the offline data loss. Hope this helps.