Altitude Accuracy missing in PWA via Mock Location (GNSS Master)

87 Views Asked by At

I am developing a PWA (Progressive Web App) using Angular. I am recommending Chrome as it has the best PWA support overall. The application allows to survey points and lines using the users location. For every point (or point in a line) position (lat/long/altitude) and accuracy (accuracy/altitudeAccuracy) are saved. We decided against connecting the GNSS system directly as it is only possible via TCP/IP for IOS/Android with one code base, and the Bluetooth Web API does not support connecting and listing only coupled devices which is why we can not manage to only list one UUID for the connection. Therefore we decided to only support Android for the PWA and require the user to connect the GNSS system via GNSS Master (and also set up the correction signal - NTRIP) there, activate Mock Location in the Developer Settings so we get the improved signal directly in the PWA when we use navigator.geolocation to access the beforementioned parameters needed for the surveyed point. The problem is that we can not manage to receive any altitudeAccuracy on Android at all (we tried with multiple Devices (Pixel 6a, Samsung Galaxy A23, Samsung Galaxy S8, ...).

We try to access the beforementioned parameters utilizing navigator.geolocation like this:

navigator.geolocation.getCurrentPosition(
  (position) => {
    resolve({
      accuracy: {
        horizontalCentimeters: position.coords.accuracy * 100,
        verticalCentimeters: position.coords.altitudeAccuracy
          ? position.coords.altitudeAccuracy * 100
          : undefined,
      },
      position: {
        coords: new LatLong(
          position.coords.latitude,
          position.coords.longitude
        ),
        altitude: position.coords.altitude ?? undefined,
      },
    });
  },
  (error) => {
    reject(new Error(this.mapToMessage(error)));
  },
  {
      enableHighAccuracy: true,
      maximumAge: 0,
      timeout: 10000,
  }
);

The problem is that we can not manage to receive any altitudeAccuracy at all on Android. On IOS we do get altitudeAccuracy values even if we do not connect a GNSS system. The part that I can not wrap my head around is the fact that if the antenna (GNSS system) is connected I see altitudeAccuracy values in other Apps (SW Maps for example) even if we mock the location as well. Where and why is the altitudeAccuracy stripped away on Android because we KNOW it is available actually.

This question was the only thing I found to be similar but it did not quite match our case as GNSS Master is only available on Android, and there is no explanation or solution given. Also we do not have a problem with displaying the correct location ONLY the altitudeAccuracy is missing. Mock GPS location and Chrome for Android

0

There are 0 best solutions below