Getting high accuracy location using GPS

Hello Guys

I am in the process of writing a simple GPS logger app, where the user will have the ability to start and stop recording location tracking.

Below is the implementation for start and stop recording. I am using the plugin cordova-plugin-geolocation and accessing Geolocation from ionic-native . The problem is Geolocation.watchPosition is never using GPS to get location and always rely on either WIFI or the mobile network even though enableHighAccuracy is set to true. This is resulting in inaccurate data. I have tested this in android latest device by publishing my app to google app store.

options = { maximumAge: 3000, timeout: 30000, enableHighAccuracy: true };
watch = Geolocation.watchPosition(options);

 startRecording() {
    this.watchSubscription = this.watch.subscribe((position) => {
      this.buffer.push({ lat: position.coords.latitude, lng: position.coords.longitude });
    });
  }
  stopRecording() {
    this.watchSubscription.unsubscribe();
  }

Please can someone help me what I am missing like any configurations in code, config.xml or play store settings etc.

Thanks
Vijay

Experiencing the same here, in a weird way, when I use this plugin from the desktop gets the location (I really don’t know how). Buy when used from Android device it gets a TOTALLY wrong location. I would also love some light about this plugin behaviour. As far as i know it uses the devices HTML5 Geolocation API.

Docs say “This API is based on the W3C Geolocation API Specification, and only executes on devices that don’t already provide an implementation.” I don’t really understand what that means.

I had the same problem. For Android i then switched to this plugin which uses Google Location Services: https://github.com/louisbl/cordova-plugin-locationservices