I'm using the Geolocation API (often referred to as "HTML5 Geolocation") to get the current position of the user. It is updated automatically if you move (checked every second). Primarily targeted (and currently tested) at iPhones, but should work on other mobile devices too. You can see an example here:
http://jsbin.com/uyoyey/
The accuracy, which you can see in each line after the pipe, is around 3000 (meters) when I'm testing (outside). Which is quite bad obviously. The native Maps-App on my iPhone is way more precise. Approximately around 10 to 30 Meters (by looking at the map and where I am standing. Checking long- and lat-values in another app also gives more accurate numbers.
When I now switch back to Safari the accuracy jumps to 10 to 30 but reverts back to 3000 after a second.
Questions:
Thanks!
Update 1:
I'm getting more accurate results when testing on other places (larger city) but am now wondering if the native Apps also use Motion Tracking to update the location. Which would explain why the Maps App can track my steps while Safari doesn't recognize them.
Update 2 (03.08.11):
In an email-conversation with Peter-Paul Koch he wrote that Safari mainly uses wifi for Geolocation to preserve battery life. Which may explain the differences.
Im still not entirely sure what is going on though.
There is no guarantee the geolocation information will be accurate, because this API can also use the IP address to infer user location in the absence of more accurate technologies, such as GPS receivers on the client's device. The browser exposes this API via the navigator. geolocation property.
Go to Settings > Privacy, then select Location Services. Select an app, then turn Precise Location on or off.
Accuracy varies but is typically within 5-15 metres. Vendors such as Combain (https://combain.com/about/about-positioning/wi-fi-positioning/) are also proposing making floor level WiFi positioning accuracy within a building, something that GPS cannot deliver.
Old: Here are the test result for getCurrentPosition function with wifi turned off on android 2.2, iOS4, and iOS5.
On both android browser and iOS 4 Safari, I'm getting GPS accuracy level in magnitude of 1000 meters. But on iOS 5 Safari, I'm able to get down to 5 meter accuracy. Seems GPS has improved on iOS 5, but it is just a small slice of the market out there. Overall, it is still not good to develop web app that relies on accurate GPS reading.
Something I found during testing - the android browser GPS stops responding after about 70 calls made to getCurrentLocation. This might be a device specific problem but it is another unreliable factor in browser based GPS functionality.
Update: I was testing with the watchPosition function call and it is produced much more accurate result on Android and iOS4. It the way to go... Sample code: http://jsbin.com/ugebif/3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With