Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

GPS reporting old coordinates
Started by leif3 Oct 15 2015 12:12 PM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

leif3

[GLOBAL: userInfoPane.html]
leif3
  • Enthusiast

  • 45 posts
  • Corona SDK

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?



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

leif3

[GLOBAL: userInfoPane.html]
leif3
  • Enthusiast

  • 45 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

leif3

[GLOBAL: userInfoPane.html]
leif3
  • Enthusiast

  • 45 posts
  • Corona SDK

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  :)




[topic_controls]
[/topic_controls]