I am making a mobile webapp for iPhone and probably other devices and am able to get the lat/long with a reasonable accuracy but I'm not getting any other values from the phone's GPS. The 'heading' is quite important for what I'm wanting to do. Is there a way for Mobile Safari to give this info or is it not supported yet? I haven't found any information about how much of the W3C Geolocation API spec is supported by the iPhone.
I have tried a few libraries but haven't found them to give more functionality to the iPhone. I'm using:
navigator.geolocation.watchPosition(on_success, on_failure, options);
The watch position works better than getCurrentPosition
seemingly because the GPS doesn't give a good reading when only called once. With watchPosition
, the position is updated as it gets more accurate then I clear it when it's an acceptable value. I've tested with iPhone 4 and iPhone 3GS both with iOS 4.0.2.
altitude, altitudeAccuracy, heading, speed all come back null
. Parameters like enableHighAccuracy and a longer responseTime or timeout did not have any effect.
Any insight, even if that it is definitively not supported, would be appreciated. Thanks!