Android phonegap application having issues with SQlite and local storage on Samsung Galaxy devices Android phonegap application having issues with SQlite and local storage on Samsung Galaxy devices android android

Android phonegap application having issues with SQlite and local storage on Samsung Galaxy devices


It might be because you are opening the database twice. Only open it once and do all of your transactions on that single instance. Also make sure that your previous transaction has finished before starting another one. You shouldn't have to worry about that, but in my experience Cordova's (PhoneGap) WebSQL is a bit finicky.


I used phonegap until 2.0 version to 3.1 for samsung and htc devices and never seen such a problem. Which version are you using? Try to use stable versions, not beta.

First of all, sometimes phonegap apps can have sync problem on startup. Maybe that issue can be related with that. You can try that just put deviceready in index.html and after deviceready, direct your page to your main page. In main page do your database operations(like creating tables and inserting).

Second, you need to trace error messages on errorCB function. error function gets a parameter and that parameter includes errorcode and errormessage. Check these out.

And last, if you are using s4 device with android version 4.4, you can debug your javascript codes with chrome. Debugging is a big advantage for phonegap. Use it.


I don't think this was a problem of the device, it could be busy. Maybe you could try to execute each order to database sequentally, using the callbacks:

BBDDD.transaction(  function(tx){     tx.executeSql("CREATE TABLE IF NOT EXISTS DateSession (\n\        id INTEGER PRIMARY KEY AUTOINCREMENT,\n\        field1 TEXT NOT NULL,\n\        field2 TEXT NOT NULL)");  },  function(err){    console.log("Error"+err.code);  },  function(){      BBDDD.transaction(function(tx){         tx.executeSql("CREATE TABLE IF NOT EXISTS Table2 (\n\          id INTEGER PRIMARY KEY AUTOINCREMENT,\n\          field1 TEXT NOT NULL,\n\          field2 TEXT NOT NULL)");      },      function(err){          console.log("Error"+err.code);      },      function(){      });  });