Reputation: 73
I am new in mobile app for the database using sqlite after searching on goolge I configure my project in visual studio but I am getting two error
after click on success get 2nd error
I am not getting any solution after searching.
I include SQLitePlugin.js in my html page and code for sqlite is
(function () {
"use strict";
document.addEventListener('deviceready', onDeviceReady.bind(this), false);
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({ name: 'my.db', location: 'default' }, function (db) {
// Here, you might create or open the table.
db.executeSql('CREATE TABLE customerAccounts (firstname, lastname, acctNo)');
}, function (error) {
console.log('Open database ERROR: ' + JSON.stringify(error));
});
// Handle the Cordova pause and resume events
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);
// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
var element = document.getElementById("deviceready");
element.innerHTML = 'Device Ready';
element.className += ' ready';
};
function onPause() {
// TODO: This application has been suspended. Save application state here.
};
function onResume() {
// TODO: This application has been reactivated. Restore application state here.
};
})();
What the mistake here?
Upvotes: 1
Views: 1182
Reputation: 10841
When you call window.sqlitePlugin.openDatabase
, SQLite Plugin will execute java native codes, which is not supported by Ripple.
From this document:
Caution: Ripple doesn’t provide a complete simulation of Cordova APIs or native device capabilities (plugins). It also doesn’t simulate specific browser versions for a particular platform. You can achieve this by testing on actual devices or emulators.
Please try that by Android Emulator or real devices.
Upvotes: 2