Background location returns random/bogus coords when tracking every 2min.

Please provide the following:

  1. SDK Version: 41
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Have a simple android react-native app that is using background location from expo-location through TaskManager and is returning coords every 2 mins. Sometimes there are junk values that are well over 1 mile (up to around 4miles) from current position with good cell and gps signal. Is this to be expected? Is there way a recommended way to filter these anomalies out?

API call to setup background locations is:
await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, {
accuracy: Location.Accuracy.BestForNavigation,
activityType: Location.ActivityType.AutomotiveNavigation,
timeInterval: 120000,
//distanceInterval: 150,
//deferredUpdatesInterval: 1000,
foregroundService: {
notificationTitle: ‘Using your location’,
notificationBody: ‘to turn off, go back to the app and switch it off.’
},

The app gets location updates when in foreground. App also continues to get location updates in background every 1 second, until some time when the app gets suspended and does not get any further location updates. When the app gets suspended varies from anywhere between few 10s of minutes to hours.

myprepaidcenter

Hey @southpawtechie, can you share more information about the device(s) you’ve tested and reproduced this issue on?

Hey @adamjnav, I’ve tested this with a Samsung S20 Ultra w/ Android 11 and an older Samsung S “something” w/ Android 8. Both of them have shown this problem.

The older device was randomly picking up locations that were about 5miles away several hours after I had been through the area and the device currently sitting on a dresser at home during the random GPS points.

The newer device was taken out about a 1-2 miles offshore and for the most part picked up when the boat was in the channel but there were quite a few random points that were 1-4 miles back on shore during the same timeframe. Roughly 25 of 90 GPS points were way off.

In both cases, the app is running in the background (to specifically test what is occurring when app is not in foreground) and occasionally may be doing other tasks (ie. text, phone, another app, etc). It seems to be able to pick up but I’m not sure if this is expected (maybe a Samsung GPS issue or maybe I should be expecting some dirty data based on power state, other apps that are taking away from the gps’ ability to provide a good position). I also understand that for the offshore, the current setting at BestForNav may not be well suited but generally it did ok except for the random bits.

Let me know if I can provide more detail.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.