I've been using cordova sqlite successfully when I have a db file inside the www folder. The problem is that now I have to download a db and unzip it within the device's documents.
that's my code so far (to get the database within www):
var app = angular.module('foobar');
app.factory('factoryDatabase', function($cordovaDialogs, $cordovaSQLite, $ionicLoading, $q, serviceConstants){
// my current db....
var currentDB = undefined;
var DATABASE_NAME = 'Data.db';
var PATH = 'Data.db';
return{
init: function(){
if (currentDB == undefined) {
currentDB = window.sqlitePlugin.openDatabase({
name: DATABASE_NAME,
createFromResource: PATH
});
}
return currentDB;
},
}
});
The main problem is the PATH constant, it's pointing to www folder (by default) and the project (http://ift.tt/1O3yCJy) doesn't seem to support changing the path to the device's files for both android and iOS
anyone had a similar issue?
Thanks!
Aucun commentaire:
Enregistrer un commentaire