$cordovaGeolocation.getCurrentPosition sometimes returns old data


#1

For the most part, $cordovaGeolocation.getCurrentPosition works great, but sometimes the GPS coordinates are old. My customers are having this problem with iPhones and Androids. Unfortunately, I have not been able to reproduce it on consistently.

I experienced the problem is this way. I used the Google map program and then drove home. About 4 hours later $cordovaGeolocation.getCurrentPosition returned the old coordinates from before I drove. Once re-opened Google maps, everything worked fine and $cordovaGeolocation.getCurrentPosition returned the correct current coordinates.

I tried setting the maximumAge to 0, but that did not help. Is there any way to force $cordovaGeolocation.getCurrentPosition to do a lookup every time the way Google maps does?

Here is the source code:
$cordovaGeolocation.getCurrentPosition({ timeout: 15000, maximumAge: 0, enableHighAccuracy: true })
.then(next, function () {
$cordovaGeolocation.getCurrentPosition({ timeout: 15000, maximumAge: 0 })
.then(next, next);
});

function next(res) {
var coords = res.coords;

$ionicLoading.show({
    template: waitMessage
});

api[funct]({
    Latitude: coords && coords.latitude,
    Longitude: coords && coords.longitude
}).then(function (res) {
    var clockMessage = res.data;
    refresh();
}, function (res) {
    var message = res.data && res.data.Message;
    $ionicLoading.hide();
});

}