flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

[Android] Altitude strange behavior

Open CMiguelRB opened this issue 3 years ago • 4 comments

💬 Questions and Help

Hi all. I don't want to fill a bug issue, as I'm not entirely sure if I'm doing something wrong. I'm developing a GPS tracking app with an altitude chart. I've been testing both, location and geolocator (both really good!) for listening to the location updates as an on screen app/foreground service. While using flutter location library, the altitude readings seem to be more natural, but when I switch to geolocator the altitude values have quite a big jumps. I'm not sure which could be the problem.

Expected behavior

Stable and accurate altitude readings.

Reproduction steps

Those are chart examples from both libraries. It's not the same path, but I've tested both in several occasions and the outcome is similar. Also, the track on the map is precise and it follows the path correctly, there are no jumps in lat and lon coordinates.

location library: Screenshot_20220221-233851

geolocator library: Screenshot_20220221-212617

Configuration

The configuration regarding distanceFilter and intervalDuration is the same for both libraries.

final LocationSettings _locationSettings = AndroidSettings(
      accuracy: LocationAccuracy.best,
      distanceFilter: 10,
      intervalDuration: const Duration(seconds: 5),
      foregroundNotificationConfig: ForegroundNotificationConfig(
        notificationText: I18n.translate('map_notification_desc'),
        notificationTitle: I18n.translate('map_notification_title'),
        enableWakeLock: true,
      ));

Version: 8.2.0

Platform:

  • [ ] :iphone: iOS
  • [x] :robot: Android

Pixel 6. Android 12.

CMiguelRB avatar Feb 22 '22 01:02 CMiguelRB

Hey @CMiguelRB, thanks for reporting your issue. I've looked into it and it's expected behaviour. Since the Location package is making use of NMEA data to get the altitude, the readings are often more accurate. The geolocator plugin is using the GPS data to fetch the altitude, which is less accurate most of the time.

We're planning to implement NMEA soon in the future. We'll keep you up to date!

florissmit1 avatar Feb 24 '22 10:02 florissmit1

Hi @florissmit1,

Thanks for the information! I'll keep track, you are doing a great work!

CMiguelRB avatar Feb 24 '22 14:02 CMiguelRB

https://github.com/Baseflow/flutter-geolocator/pull/1057 has been created to allow Geolocator to have the same behaviour as the location package by requesting that altitude be reported as MSL.

Wackymax avatar May 10 '22 17:05 Wackymax

@mvanbeusekom this can probably be closed?

Wackymax avatar Sep 10 '22 10:09 Wackymax