cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Bowser (JIRA)" <>
Subject [jira] [Commented] (CB-6033) Android 4.4 update loses LocalStorage data
Date Thu, 20 Feb 2014 21:57:30 GMT


Joe Bowser commented on CB-6033:

There is something that we can do.  I put this code both in CordovaActivity and CordovaWebView's

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());

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

This message was sent by Atlassian JIRA

View raw message