Cannot read property 'openDatabase' of undefined in android


#1

Trying to use the plugin to manage database on the mobile device, SQLite, through the ngCordova implementation, but it shows me the same error every time I try to create the database. The phone have Android 4.2.2

TypeError: Cannot read property 'openDatabase' of undefined

angular.module('starter', ['ionic', 'ngCordova'])
    .run(startApp)
    .controller('networkCtrl', networkCtrl)
    .factory('databaseFtr', databaseFtr);

###Start App

startApp.$inject = ['$ionicPlatform'];

function startApp($ionicPlatform) {

    $ionicPlatform.ready(function() {

        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
            cordova.plugins.Keyboard.disableScroll(true);
        }

        if (window.StatusBar) {
            StatusBar.styleDefault();
        }

    });

}

###Controller

networkCtrl.$inject = ['$scope', 'databaseFtr'];

function networkCtrl($scope, databaseFtr) {
    databaseFtr.crearDB();
}

###Factory

databaseFtr.$inject = ['$cordovaSQLite'];

function databaseFtr($cordovaSQLite) {

    return {

        crearDB: function() {

            var db;

            db = $cordovaSQLite.openDB({
                name: "mydata.db",
                location: 'default'
            });


        }

    }

}