No DB in Local www and on Android device with SQLite plugin

Hi,

I use sqlite plugin for my app, with a DB including 3 tables.
On desktop, everything is working, the app access’ to data. But, i didn’t find the DB in folders, and when a run on my device, there is no db in app/package folder.

Here is my code:

indent preformatted text by 4 spaces

var db=null;

var myApp = angular.module(‘starter’, [‘ionic’, ‘ngCordova’])

myApp.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {

if (window.cordova) {
db = $cordovaSQLite.openDB({ name: “my.db”, location: 1, iosDatabaseLocation: ‘default’ }); //device
}else{
db = window.openDatabase(“my.db”, ‘1’, ‘my’, 1024 * 1024 * 100); // browser

}

$cordovaSQLite.execute(db, “CREATE TABLE IF NOT EXISTS Utilisateur (id integer primary key, cleapi integer, siret integer)”);
$cordovaSQLite.execute(db, “CREATE TABLE IF NOT EXISTS Avis (id integer primary key, siret integer, note integer, date text, reference text, titre text, texte text )”);
$cordovaSQLite.execute(db, “CREATE TABLE IF NOT EXISTS InfosAdherent (id integer primary key, notegenerale integer, nbavis integer, avispos integer, avisneu integer, avisneg integer, datedebut text )”);

});
})

.controller(‘CtrlConnexion’, function($scope, $cordovaNetwork, $rootScope,$http, $cordovaSQLite) {
document.addEventListener(“deviceready”, function () {

if (window.cordova) {
db = $cordovaSQLite.openDB({ name: “my.db”, location: ‘default’, iosDatabaseLocation: ‘default’ }); //device
}else{
db = window.openDatabase(“my.db”, ‘1’, ‘my’, 1024 * 1024 * 100); // browser

}

var query = “INSERT INTO Utilisateur (id,cleapi,siret) VALUES (1,1234,73282932000074)”;
$cordovaSQLite.execute(db, query).then(function(res) {
console.log(“ok uti”);
alert(“ok uti”);
}, function (err) {
console.error(err);
console.log(“pas ok user”);
});

var query1 = “INSERT INTO Avis (id,siret, note, date, reference,titre, texte) VALUES (1,73282932000074,3,‘24/12/2013’,‘REFREDF’,‘Titreavis’,‘texteavis’)”;
$cordovaSQLite.execute(db, query1).then(function(res) {
console.log(“ok avis”);
alert(“ok avis”);
}, function (err) {
console.error(err);
console.log(“pas ok avis”);
});

var query2 = “INSERT INTO InfosAdherent (id,notegenerale,nbavis,avispos,avisneu,avisneg,datedebut) VALUES (1,4,6,2,3,1,‘11/04/2011’)”;
$cordovaSQLite.execute(db, query2).then(function(res) {
console.log(“ok infos”);
alert(“ok infos”);
}, function (err) {
console.error(err);
console.log(“pas ok infos”);
});

    $scope.network = $cordovaNetwork.getNetwork();
    $scope.isOnline = $cordovaNetwork.isOnline();
    $scope.$apply();
    
    // Si on est en ligne
    $rootScope.$on('$cordovaNetwork:online', function(event, networkState){
        $scope.isOnline = true;
        $scope.network = $cordovaNetwork.getNetwork();            
        $scope.$apply();
    })

    // Si on est hors ligne
    $rootScope.$on('$cordovaNetwork:offline', function(event, networkState){
        console.log("got offline");
        $scope.isOnline = false;
        $scope.network = $cordovaNetwork.getNetwork();
        $scope.$apply();
    })

    console.log(FileTransfer);

}, false);
})

login.html

... ... ...

index.html :

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script type="text/javascript" src="plugins/cordova-sqlite-storage/www/SQLitePlugin.js"></script>




<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>




<!-- your app's js -->
<script src="js/app.js"></script>

I tried many solutions (in device ready, db init args location, …) but nothing works.

Hope somebody can help me ^^

Cheers