I am writing an android app, I am using phonegap and with weinre for debugging.
Some info:
$ phonegap -v
5.3.9
$ cordova plugin list
cordova-plugin-whitelist 1.2.0 "Whitelist"
cordova-sqlite-storage 0.7.14 "Cordova sqlite storage plugin"
The plugin is installed, but when I run it with phonegap and open it in my phone, nothing shows up in the console. No error, nothing. The window object was printed in the console, but not everything else.
I am using the default configuration of phonegap, can anybody tell me why this is happenning?
This is the code I have written in my js script.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(event) {
console.log(window);
//var db = window.sqlitePlugin.openDatabase({name: "my.db"});
//var openDatabase = sqlitePlugin.openDatabase;
console.log(window.sqlitePlugin);
console.log(window.sqlitePlugin.openDatabase);
var db = window.sqlitePlugin.openDatabase({name: "test.db"},
function(db) {
console.log('db open succeeded');
},
function(err) {
console.log('Open database ERROR: ' + JSON.stringify(err));
}
);
db.executeSql("create table tmp 'column1' INT;", [], function (res) {
console.log('got stringlength: ' + res.rows.item(0).stringlength);
}, function(error) {
console.log('SELECT error: ' + error.message);
});
db.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (res) {
console.log('got stringlength: ' + res.rows.item(0).stringlength);
}, function(error) {
console.log('SELECT error: ' + error.message);
});
}