Ok. I have found an answer.
The crucial word is local
. The plugin needs to be installed with local
word:
phonegap local plugin add https://github.com/christocracy/cordova-plugin-background-geolocation.git
So far, on Phonegap 3.3 it created all perfectly as expected. Follow the further instructions from the plugin's web-site and you are good to go. A side note, if you are using Angular.js then if you would like to use this inside some service, add '$window' in list of your dependencies. E.g.:
angular
.factory('Auth', [ '$http','$q', '$window', '$rootScope', '$location', 'Application', 'Service', function($http,$q, $window, $rootScope, $location, Application, Service){
// Some code and then:
function callbackFn(){
//callback for ios
}
function failureFn(){
//callback for ios
}
function connect(){
var bgGeo = $window.plugins.backgroundGeoLocation;
bgGeo.configure(callbackFn, failureFn, {
url: "www.yoursite.com/api/location_saver.json",
params: { // HTTP POST params sent to your server when persisting locations. It will be posted to your server as is , so you can set any parameter you want
user_credentials: "aS9393498asdFfaSDF",
parameter2: "another parameter value I want to send"
},
desiredAccuracy: 10,
stationaryRadius: 1,
distanceFilter: 1,
debug: true // <-- enable this hear sounds for background-geolocation life-cycle.
});
bgGeo.start();
}
}