2

I have an app which uses forge.geolocation.getCurrentPosition. It seems that at times, the location does not refresh. I can open the iOS app in one position, and then an hour later 5 miles away, open the app again (either resume, or completely close the app from the tray, and re-open) and still the old location is returned.

I am using this form

forge.geolocation.getCurrentPosition({enableHighAccuracy: true}, function (location) {})

Note that when opening/resuming the App, the GPS icon at the top DOES show up however the location returned to the javascript code is incorrect.

The above bug was reproduced on iOS 6

After opening the Maps app, and going back to my app, the correct location is finally returned.

Any idea how to fix this?

Alon Burg
  • 2,500
  • 2
  • 27
  • 32
  • I'm having the same problem. I tried calling the method several times, but the accuracy and the location are identical each time. It wouldn't be too bad but I'm getting an accuracy of over 1000m over here. – Mala Jan 20 '13 at 05:57

1 Answers1

2

getCurrentPosition returns the best data it has at that particular time - I'd recommend calling the method a number of times until the indicated accuracy is reduced to an acceptable level.

What we might do in the future is support watchPosition so that something like https://stackoverflow.com/a/8554835 would be possible through the forge API

Community
  • 1
  • 1
James Brady
  • 27,032
  • 8
  • 51
  • 59
  • In Cordova/Phonegap the options params can be used to specify maximumAge which seems to be the exact problem. From what I tested, it doesn't matter how many times I will call this function or for how long - as long as the maximumAge is not passed, the last location will be returned. Also the timeout parameter seems to me missing from Trigger.io and results in Android devices which never return to success or error callbacks. See [Corodva Documentation](http://docs.phonegap.com/en/1.0.0/phonegap_geolocation_geolocation.md.html#geolocationOptions) – Alon Burg Dec 08 '12 at 05:13
  • When I call getCurrentPosition multiple times, I get the exact same coordinates and accuracy every time, no matter how long I let it loop – Mala Jan 20 '13 at 16:46