GPS reporting old coordinates

I have made an app which is used to register visits on mountain tops etc. (‘Georeg’ in Google Play and Apple Store). The app retrieves coordinates from the GPS and sends them as text (SMS) when a Register-button is tapped. The coordinates are accepted if the GPS accuracy is reportet to be <30m.

So far so good, everything works as expeted. But… some users close the app right after registering. Then, when coming home relaxing on their coach they reopen the app. Now the old coordinates AND accuracy pops up and they are able to re-register. It seems like Corona fetches initial data from the GPS before the GPS has achieved satellite fix (3 or more satellites received).

I have tried to ignore the 3 first data transfers from the GPS, but this doesn’t seem to help. Is there a way to detect when the GPS actually has obtained satellite fix?

Hi @leif3,

Could you set the UTC timestamp when the user “registers” actual visits (save it to a persistent variable and/or within a file in the app’s sandbox), then later, when the user returns to the app, compare that timestamp to the “event.time” of new GPS responses? If the difference was enough, then you could assume that the user is no longer standing in the location where they initially registered. Just an idea… perhaps that won’t be enough though.

https://docs.coronalabs.com/api/event/location/time.html

Best regards,

Brent

Hi Brent,

Thanks for your advice, I will check if this is a way to go. I am a little surprised that the satellite fix indicator (A) available in many NMEA sentences from a GPS UART is not obtainable in Corona. I would expect this to be an important parameter in most GPS applications.

What I have done to overcome the problem,

  • Use the GPS-time (event.time)  instead of the OS time (os.time) when reporting the registration

  • Require the GPS update rate to be lower than 2 seconds before registration is accepted

I hope this will cure the “old coordinates” issue. Looks promising  :slight_smile:

Hi @leif3,

Could you set the UTC timestamp when the user “registers” actual visits (save it to a persistent variable and/or within a file in the app’s sandbox), then later, when the user returns to the app, compare that timestamp to the “event.time” of new GPS responses? If the difference was enough, then you could assume that the user is no longer standing in the location where they initially registered. Just an idea… perhaps that won’t be enough though.

https://docs.coronalabs.com/api/event/location/time.html

Best regards,

Brent

Hi Brent,

Thanks for your advice, I will check if this is a way to go. I am a little surprised that the satellite fix indicator (A) available in many NMEA sentences from a GPS UART is not obtainable in Corona. I would expect this to be an important parameter in most GPS applications.

What I have done to overcome the problem,

  • Use the GPS-time (event.time)  instead of the OS time (os.time) when reporting the registration

  • Require the GPS update rate to be lower than 2 seconds before registration is accepted

I hope this will cure the “old coordinates” issue. Looks promising  :slight_smile: