Every time I use the Geolocation to auto locate the device, it always returns the old position that was located the first time Geolocation was used. It seems to be a caching problem.
options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
public locateUser() {
this.isLoading = true;
Plugins.Geolocation.getCurrentPosition(this.options)
.then(geoPosition => {
const coordinates: Coordinates = {
lat: geoPosition.coords.latitude,
lng: geoPosition.coords.longitude
};
this.returnUserLocation(coordinates.lat, coordinates.lng);
this.isLoading = false;
console.log(coordinates.lat , coordinates.lng); // Always prints the same coordinates
})
.catch(err => {
this.isLoading = false;
this.showErrorAlert();
});
}