I have an application that uses HTML5 local storage. The data in local storage is persistent throughout the app, while the app is open or closed. However, when the app was updated from the store, the local storage was erased. Is there a way to prevent the loss of local storage during app updates? Thanks!
mWebView = (WebView) findViewById(R.id.mWebView);
WebSettings mWebSettings = mWebView.getSettings();
mWebSettings.setAllowFileAccess(true);
mWebSettings.setDatabaseEnabled(true);
mWebSettings.setDatabasePath("/data/data/"+this.getPackageName()+"/databases/");
mWebSettings.setDomStorageEnabled(true);
mWebSettings.setJavaScriptEnabled(true);
There are answers to this posted here
The answer given by Mr Boyfox was
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setDatabaseEnabled(true);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
webView.getSettings().setDatabasePath("/data/data/" + webView.getContext().getPackageName() + "/databases/");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With