Android - Making Webview DomStorage persistant after app closed
Did you set the DatabasePath? Android doesn't know where to save the DOMDatabase by default, if you don't set it calling
webview.getSettings().setDatabasePath()
// Confimed on android 2.1 emulator// enable javascript localStorageWebSettings webSettings = myWebView.getSettings();webSettings.setDomStorageEnabled(true); // localStorage// e.g., if your package is www.myapp.whatever;webSettings.setDatabasePath("/data/data/www.myapp.whatever/databases/");
You must enable the database as well as setting its path:
webview.getSettings().setDatabaseEnabled(true);webview.getSettings().setDatabasePath();webSettings.setDomStorageEnabled(true);
The first line caught me out for quite a while...