Hi Remi, not sure how you mean 2,3,4.. watch position events as the
code only runs once at "initialise map" at startup so It should only
be one watchPosition event in watchID right?
Isnt the point of using the watchPosistion that it follow the gps
point until you shut down the listner, in that example code it seems
it runs the watchposition as a function over and over again until the
checkbox is unchecked..?
Then one have to agree to let the website get you position all the
time..
function getLocation()
{
document.getElementById('output').innerHTML +='watching for
location...<br>';
watchID = navigator.geolocation.watchPosition(
foundLocation,
errorLocation,
{
enableHighAccuracy: true,
maximumAge: 30000,
timeout: 27000
}
);
}
function foundLocation(e)
{
var op = document.getElementById('output');
op.innerHTML += 'Accuracy: '+e.coords.accuracy+'<br>';
op.innerHTML += 'Altitude: '+e.coords.altitude+'<br>';
op.innerHTML += 'AltitudeAccuracy: '+e.coords.altitudeAccuracy
+'<br>';
op.innerHTML += 'Heading: '+e.coords.heading+'<br>';
op.innerHTML += 'Latitude: '+e.coords.latitude+'<br>';
op.innerHTML += 'Longitude: '+e.coords.longitude+'<br>';
op.innerHTML += 'Speed: '+e.coords.speed+'<br>';
op.innerHTML += '--------------------<br>';
window.navigator.geolocation.clearWatch(watchID);
if(document.getElementById('stopWatching').checked!=true)
getLocation();
}
--
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.