Baseflow / Baseflow/flutter-geolocator

Inaccurate Location Tracking: Randomly Drifting GPS Points

Open
#1,574 18 comments 9 reactions 1 assignee Claimed by @TimHoogstrate View on GitHub
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

### Please check the following before submitting a new issue.

- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [X] I have carefully [read the documentation](https://github.com/baseflow/flutter-geolocator/blob/main/geolocator/README.md).

### Please select for which platform(s) you need help

- [X] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows

### Your question

I'm developing a Flutter application to track the user's location every 30 seconds and generate a route.

I've encountered an issue where the package occasionally records GPS coordinates that are significantly far from the device's actual location, causing unexpected deviations in the generated route. These inaccurate readings seem to occur randomly and then correct themselves after a short period.

```
final LocationSettings locationSettings = AndroidSettings(
intervalDuration: const Duration(seconds: 30),
accuracy: LocationAccuracy.bestForNavigation,
foregroundNotificationConfig: const ForegroundNotificationConfig(
// Explain to the user why we are showing this notification.
notificationText:
'App will continue to receive your location even when you arent'
' using it',
// Tell the user what we are doing.
notificationTitle: 'Running in Background',
// Give the notification an amber color.
color: Colors.amber, setOngoing: true,
),
);
Geolocator.getPositionStream(locationSettings: locationSettings).listen(
(Position position) async {
await BackGpsRepository().checkAndSend(position);
},
);
```

Expected Behavior:
The package should consistently provide accurate GPS coordinates, allowing for the generation of a smooth and realistic route.

Actual Behavior:
The package intermittently records GPS coordinates that are significantly off, resulting in a distorted route with unexpected jumps.

Additional Information:

Package Version: 13.0.1
Flutter Version: 3.22.3
Affected Devices: g54 Motorola
Operating Systems: Android
Permissions in AndroidManifest:

In this case i stay on the same position and randomly throw a position far away and comeback later.
![Screenshot_20240920-131135 (1)](https://github.com/user-attachments/assets/b70dcbfe-224e-4416-86a6-2360c019bf06)

### Version

13.0.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.