react-native-background-geolocation: Duplicate Coordinates
Your Environment
- Plugin version: 2.10.1
- Platform: iOS or Android
- OS version: N/A
- Device manufacturer / model: N/A
- React Native version (
react-native -v
): 55.2 - Plugin config
desiredAccuracy: 25,
maximumAge: 20000,
samples: 2,
timeout: 20,
distanceFilter: 30,
foregroundService: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_ERROR,
preventSuspend: true,
We’re using our own library to send the requests and have validated that the problem isn’t there.j
Expected Behavior
Events with identical cooridinates are rarely generated
Actual Behavior
We’re seeing location events coming through with identical coordinates. This is only on devices out in the wild and we can’t reproduce on our test devices, so this is more of a question rather than a bug report.
Sometimes the timespan between the events is milliseconds and other times it’s hours. They’re not always sequential either and we’re seeing instances across iOS and Android.
What are the conditions required for the device to report the same lat/lng coordinates? I’d assume that would be very rare and tried doing some research but couldn’t find anything concrete. We do have a maxAge on getCurrentPosition
, but it’s only set to 20s. Is there any other valid reason where that method would return coordinates that have been sent previously?
Steps to Reproduce
N/A
It’s worth mentioning we use background location tracking and getCurrentPosition
, triggered on certain app actions.
Debug logs
Have asked affected users to submit email logs. Will attach as and when they come through.
I have attached a csv example of events recorded in our database. Not sure it will help, but might be relevant.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (7 by maintainers)
Case 1
I don’t understand your problem here. Requesting 3 locations within a few milliseconds is nearly guaranteed to give you the same coords.
Case 2
The case
#2
doesn’t really apply. This is a special case where aproviderchange
event occurs without access to location-services. The Android plugin automatically records a location where the device was when theproviderchange
event occurred. When location-services is completely disabled, obviously fetching the current location is impossible so the plugin does the best it can and applies the last known location to the event.However, perhaps I should re-generate the
uuid
to make it unique. It will still have identical coordinates to some previous location.yes.
It’s not a big deal. The native location apis hold a reference to the last known location.
There was none in this case. It can happen at boot before the location apis lock in and fetch a location.