Am new to Hybrid app development, Am using Cordova v5, Ionic and PouchDB for my app. It seems everything works fine on Ionic serve command, but any operation on PouchDB seems to be not working on actual devices running Android Lollipop.
Am explicitly specifying 'WebSQL' when creating pouchDB object. I don't know whether Am missing any steps.
Here is the code
var houselst = JSON.parse('<some json string>');
new PouchDB('SH_HouseVisitDB', { adapter: 'websql' }).destroy().then(function () {
return new PouchDB('SH_HouseVisitDB');
}).then(function (db) {
var doc = {
"_id": "houselist",
"items": houselst
};
//insert the doc to pouchDB
db.put(doc);
db.get('houselist').then(function (doc) {
vm.houselist = _.sortBy(doc.items, "name");
db.close();
});
}
Any help will be greatly appreciated.
Thank you for the support.
Finally figured it out, We need to name the db with websql prefix. I found the solution from the following thread.