chronotrigga
chronotrigga

Reputation: 609

Cordova SQLite Plugin not functioning with Android Studio

I had trouble updating my cordova version in Android Studio and as a result I decided to just create a new Cordova project via terminal and then re-insert all my files back into the www folder (except for cordova.js and cordova_plugins.js). When I run my simulator, everything works great except the SQLite Plugin I have that pulls the database from the assets folder is not retrieving at all. I haven't changed anything and even looking at the code and logs I see "channel not fired".

Is this the root cause of the issue? I'm new to android studio and there is terminology that I'm not aware of. I'm just trying to get SQLite Plugin to pull correctly and I don't think any code should have changed from Android Studio via Eclipse. Any help would be great thanks!

enter image description here enter image description here

Upvotes: 0

Views: 505

Answers (2)

Dhruv
Dhruv

Reputation: 1799

SQLite also works without any plugin. You can use it as below.

var db = window.openDatabase(name, version, display_name, size);
db.transaction(populateDB, errorCB, successCB);

function populateDB(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
    tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
    tx.executeSql('DROP TABLE IF EXISTS DEMO');
}

function errorCB(err) {
    alert("Error processing SQL: "+err.code);
}

function successCB() {
    alert("In Success");
}

For more details, you can refer this link.

Upvotes: 1

Akintoba
Akintoba

Reputation: 111

I used netbeans to develop my app and i think sqlite work without using the plugin self and work correctly on android too. My answer is try removing and re adding the plugin or test without the plugin. Hope it help

Upvotes: 0

Related Questions