I want to use http://ngcordova.com/docs/plugins/backgroundGeolocation/ plugin to send GPS lat long to firebase, but it seems that the plugin does not work. I cannot get the GPS based on the sample code below:
module.controller(‘MyCtrl’, function($scope, $cordovaBackgroundGeolocation) {
var options = {
// https://github.com/christocracy/cordova-plugin-background-geolocation#config
};
document.addEventListener(“deviceready”, function () {
// `configure` calls `start` internally
$cordovaBackgroundGeolocation.configure(options)
.then(
null, // Background never resolves
function (err) { // error callback
console.error(err);
},
function (location) { // notify callback
console.log(location);
});
$scope.stopBackgroundGeolocation = function () {
$cordovaBackgroundGeolocation.stop();
};
}, false);
});
Has anyone tried before?
Thanks!