inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
54 stars 16 forks source link

Location not getting refetched from camera after previous uses fell below accuracy threshold #1688

Open kueda opened 2 weeks ago

kueda commented 2 weeks ago

Describe the bug Hard to replicate, but as reported by Carrie, you can make a lot of observations and if one use of the camera within the session gets coordinates with accuracy that are below 10m, you may end up with all your subsequent observations having exactly the same coordinates. Restarting the app or otherwise unloading the camera component would reset it.

To Reproduce (Theoretical) steps to reproduce the behavior:

  1. Make sure you are using an iPhone with a SIM card so you are getting the finest location accuracy possible, or prepare to wait a long time for GPS positions to get really accurate
  2. Open the StandardCamera
  3. Take photos or wait for 10 seconds to make sure you're getting a good location read
  4. On ObsEdit, confirm the coordinates are below 10m. If not, repeat previous steps until you get to that state
  5. Walk for 5 minutes
  6. Make a new observation with the StandardCamera
  7. Walk for 5 minutes
  8. Make a new observation with the StandardCamera
  9. All of the observations you just created have exactly the same coordinates

Expected behavior The coordinates should get refetched every time the camera is opened.

Context (please complete the following information):

Additional context Carrie reported this, and at present her symptomatic observations are at https://www.inaturalist.org/calendar/carrieseltzer/2024/6/15. This is almost certainly related to my recent work on continuous location fetch. It's probably just holding on to the one user location when it falls below the accuracy threshold, and I didn't catch it b/c my iPhone SE w/o a SIM card generally never gets much bettern than 20-30 m.

kueda commented 1 week ago

FWIW, I have tried a number of approaches here and I'm out of options. The problem isn't really about when we ask for coordinates, but something weirder about getting stale coordinates while offline. I can replicate like this:

  1. Start an obs w/o evidence
  2. Wait for acc to fall below 10m
  3. Save
  4. Go into airplane mode
  5. Repeat previous steps and get exactly the same coordinates... even if you move

If you look at the timestamp of the location you get back, it's stale... and it never freshens up. I tried

IMO, this is still a bad bug, b/c people who happen to get a really good location read and then lose connection are going to end up with a lot of bad coordinates. I just don't know what to do about it.