[
https://issues.apache.org/jira/browse/CB-6033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13907584#comment-13907584
]
Joe Bowser commented on CB-6033:
--------------------------------
There is something that we can do. I put this code both in CordovaActivity and
CordovaWebView's initialization:
{code:title=Bar.java|borderStyle=solid}
private void kkDatabaseUpdate(String appDatabase) {
//Check for legacy database.
String DB_BASE_PATH = appDatabase + "/localstorage";
//Move file for legacy database to another directory!
//File sdCard = Environment.getExternalStorageDirectory();
File localStorage = new File(DB_BASE_PATH);
File[] contents = localStorage.listFiles();
Log.d(TAG, "Checking directory for existing files");
if(contents != null)
{
for ( File f : contents) {
Log.d(TAG, f.getAbsolutePath());
}
}
}
{code}
This in theory should show every database in the localStorage directory. Then
I used mobile-spec to create the database, then did the OTA update. It seems
that the file exists until we initialize the WebView. Therefore, it should be
possible to do the temporary backup on the activity and then look for the
backup on the WebView itself and copy the files back into where they're
supposed to be. I don't know if this mixing and matching will screw with the
webview or not, since I don't know what the differences are between the two
SQLite datastores.
> Android 4.4 update loses LocalStorage data
> ------------------------------------------
>
> Key: CB-6033
> URL: https://issues.apache.org/jira/browse/CB-6033
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Reporter: Darryl Pogue
> Assignee: Joe Bowser
>
> This appears to be a result of the switch from old WebView to the new
> Chrome-powered WebView.
> If an app is installed in 4.3 and saves data to LocalStorage (and possibly to
> WebSQL) and then the device is updated to 4.4, that data appears to be lost.
> Some threads regarding the problem:
> http://www.sencha.com/forum/showthread.php?278158-localStorage-cleared-when-upgrading-to-KitKat-(Android-4.4)
> https://groups.google.com/forum/#!msg/phonegap/rNizMKW5GaA/g1XBBco2otMJ
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)