I am getting database: undefined in phonegap with android. I am creating some tables in phonegap and after successful creation of tables it gives me the database undefined error. please help. i am new to phonegap. code -
var db;
var dbCreated = false;
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
//alert("In Device Ready...");
db = window.openDatabase("sgpw", "1.0", "PhoneGap Demo", 200000);
db.transaction(populateDB, transaction_error, populateDB_success);
}
I got same problem when was new to phonegap. Try this ,
var db = window.openDatabase("sgpw", "1.0", "PhoneGap Demo", 200000);
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
db.transaction(populateDB, transaction_error, populateDB_success);
}
This will then call populateDB
function.
If error comes then will call transaction_error
.
If successful then will call populateDB_success
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With