I'm developing Phonegap application, and in the deviceready i'm initializing a web sql database.
It works fine in general, but sometimes, the callback of the "_db.transaction" function doesn't get fired (neither the error nor the success callback).
Its important to mention that after it happens, it keep happening all the time, even when i enter the app and click the "Back" button which triggers "navigator.app.ExitApp()", if i open the app again it still happens. the only way to resolve it is to enter the "Manage Apps" in "Settings" and click "Force Close", and then the app opens fine (success callback is raised).
I tried to investigate, and just found that in my Galaxy III mini, SOMETIMES (maybe its not the cause, but its the best i could find) when i minimize the app, and then "Force Close" it from the "Manage Apps" in the "Settings", the bug happens (the callbacks doesn't get fire, no matter how many times i try to re-open the app).. and then to resolve it, like i said before, i need to do the "Force Close" again..
I would appreciate any suggestion and help, Liran.
that my web sql initializing code:
function initDB() {
var d = $.Deferred();
console.log('Initializing local DB..');
_db = window.openDatabase("spydb", "1.0", "Spy DB", 100000);
_db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS news (record_id INTEGER, member_id INTEGER, dateAsSecs1970 TEXT, fid_friend INTEGER, fid_partner INTEGER, message TEXT, PRIMARY KEY (record_id, member_id))');
}// Transaction failed
, function(err) {
console.log('error at initDB(): ' + err.message);
d.reject(err);
}, // Transaction succeeded
function() {
console.log('DB init succeeded');
d.resolve();
});
return d;
}