Problems with Open-Source Downloads read and

[SOLVED] LocalStorage not persisting across program sessions on Android

  • Me again, sorry!

    I've been using the excellent LocalStorage method of storing data on my Android device. Sample code:
    @ var db=LocalStorage.openDatabaseSync("MyDB","1.0","This is my DB",1000000);
    function(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS ATable(dataname TEXT, latestdatetime TEXT)');
    tx.executeSql("INSERT INTO ATable VALUES ('Hats','0')");
    It works very well for storing the data in, and once I've used insert statements, I can get the data back out using selects. However when I exit the application and start it back up, the database starts up blank. I tried using QSqlDatabase functions in the C++ section of my code and got the same result.

    I have the WRITE_EXTERNAL_STORAGE permission in my AndroidManifest.xml. Is there anything else I need to do to make the data persist between instances of the program?

  • Ah, never mind. It appears that whenever I press the Run button, since QtCreator is redeploying the app, it's also causing the app's data on the device to reset. Running up the app on the device without going via QtCreator results in the data persisting.

Log in to reply