Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :)

like image 258
RPB Avatar asked Jul 22 '26 04:07

RPB


1 Answers

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.

like image 158
PC. Avatar answered Jul 23 '26 17:07

PC.