Background Geoloc not getting locations?


#1

hi , am trying to get the geolocation using the background geolocation plugin, am using the code below:

    $ionicPlatform.ready(function () {

    window.navigator.geolocation.getCurrentPosition(function(location) {
    console.log(location);

    var bgGeo = window.plugins.backgroundGeoLocation;

    var yourAjaxCallback = function(response) {
        console.log("You must execute the #finish method here");
        bgGeo.finish();
    };

    var callbackFn = function(location) {
        console.log('[js] BackgroundGeoLocation callback:  ' + location.latitude + ',' + location.longitude);
                 
        yourAjaxCallback.call(this);
};

    var failureFn = function(error) {
        console.log('BackgroundGeoLocation error'+error);
    };

    bgGeo.configure(callbackFn, failureFn, {
        desiredAccuracy: 0,
        stationaryRadius: 50,
        distanceFilter: 50,
        locationUpdateInterval: 5000,
        activityType: 'Other',
        debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
        stopOnTerminate: false // <-- enable this to clear background location settings when the app terminates
    });
    bgGeo.start(callbackFn, failureFn);
});

after running the app and checking my console, am not getting the “[js] BackgroundGeoLocation callback” massage even after moved and change my locations. any help ??