document.addEventListener("deviceready", init, false);
var app = {};
app.db = null;
app.openDb = function() {
if(window.sqlitePlugin !== undefined) {
app.db = window.sqlitePlugin.openDatabase("XXXXXX");
alert("SQLITE");
} else {
// For debugin in simulator fallback to native SQL Lite
console.log("Use built in SQL Lite");
app.db = window.openDatabase("XXXXXX", "1.0", "Cordova Demo", 200000);
}
}
app.createTable = function() {
var db = app.db;
db.transaction(function(tx){
//creating table here
});
}
function init() {
navigator.splashscreen.hide();
app.openDb();
app.createTable();
}
I declare this on my Main JS,. I follow whats on the SQLite sample. when I run SQLite sample its save on local. but in my codes with same declaration. Its doesn't run creating the SQLite.
What would be the problem?
My declaration of plugin is ok like on the sample SQLite.