[geolocation]No altitude accuracy values for Android devices

Hello!

I am using the Geolocation API in my PWA (implemented with Angular). When starting the app on my Android phone, with Google Chrome,  I do not get any altitude data. When opening the same app on my iOS device, the altitude data is sent correctl.

My question now would be:
Why do I get altitude and altitude accuracy data with my iOS device and not my Android device, when I implemented it same? I also connected the Android device with an antenna and GNSS Master and no altitude accuracy was sent.

Here is a code snippet on how I use the GeoLocation API:
getCurrentGpsData() {
    return new Promise<GpsData>((resolve, reject) => {
      if (!this.browserHasGps)
        reject(new Error('Geolocation is not supported by this browser.'));

      const positionOptions = this.getDefaultPositionOptions();

      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
              )
            },
          });
        },
        (error) => {
          reject(new Error(this.mapToMessage(error)));
        },
        positionOptions
      );
    });
  }

where positionOptions is defined here:

private getDefaultPositionOptions(): PositionOptions | undefined {
    const highAccuracyOptions: PositionOptions = {
      enableHighAccuracy: true,
      maximumAge: 0,
      timeout: 10000,
    };

    return highAccuracyOptions;
  }

-----------------------------------------------
Even when we are connected with an antenna, we do not get any altitude accuracy, but we know for 100% that the antenna is getting and sending this information. When we are using no antenna we get the altitude accuracy on iOS devices, but not on Android with the same code. We tried it with Google Pixel 6 and a Samsung Galaxy A33 5G.

Is there any mistake I am making? Or do you know why it is working on iOS perfectly and on Android not?

Kind regards!

Received on Wednesday, 24 January 2024 08:57:35 UTC