0

I am working on a nativescript-Angular2 app. I'm trying to use nativescript-geolocation plugin to fetch the user's location. But when I am calling the "getCurrentLocation" it is giving error, saying "New location is older than requested maximum age!"

Here is my Environment Info.

nativescript 2.5.0
tns-core-modules 2.4.4
tns-android 2.5.0
tns-ios 2.5.0 nativescript-geolocation 0.0.19

Here is my code sample.

ngOnInit() {
 if (!isEnabled()) {
  enableLocationRequest();
 }
}

buttonTap() {
  var location=getCurrentLocation({desiredAccuracy:3,updateDistance:10,maximumAge: 20000, timeout: 20000 }).
  then(function (loc) {
    if (loc) {
      console.log("User location is: " + loc);
    }
  }, function (e) {
    console.log("Error: " + e.message);
  });
 }

Please help.

Anurag
  • 84
  • 3
  • 17

0 Answers0