Yep, good way to do it also, using watchPosition and clearWatch when
e.coords.accuraty < 100.
function foundLocation(e)
{
window.navigator.geolocation.clearWatch(watchID);
if(e.coords.accuracy > 100)
getLocation();
else {
// do what you want
}
}
Remi
On Fri, Dec 9, 2011 at 13:28, Mogens Beltoft <[email protected]> wrote:
> Mine behaves as expected, try my code out:
> http://geolocation.beltoft.dk/
>
> It stops the geolocation process as soon as the accuracy is below 100m.
>
> /Mogens
>
> On 09/12/2011 09:17 "Thoern"
> <[email protected]><[email protected]>wrote:
>
> Funny thing, after upgradeing to ios 5 and its new version of Safari I
> can not shut of the geolocation, it continues to track the position
> after turning it of, any ideas? It worked fine in previous versions of
> safari/ios.
> I have a checkbox that one can turn of the geolocation...code below :
>
>
>
>
> Starting geolocation
> if (navigator.geolocation) {
> watchID = navigator.geolocation.watchPosition(foundLocation,
> geo_error, { enableHighAccuracy: true, maximumAge: 30000, timeout:
> 27000 });
>
> } else { bla bla bla...
>
>
>
>
>
> Shuting of code
>
> function clearWatch(watchID) {
> if (document.lagerform.chkgps.checked == false) {
> window.navigator.geolocation.clearWatch(watchID);
>
> }
> else {
> watchID =
> navigator.geolocation.watchPosition(foundLocation, geo_error,
> { enableHighAccuracy: true, maximumAge: 30000, timeout: 27000 });
>
> }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "iPhoneWebDev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/iphonewebdev?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en.