PhoneGap-----Geolocation
<!DOCTYPE html> <html> <head> <title>Device Properties Example</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="urf-8"> document.addEventListener("deviceready",onDeviceReady,false); var watchID = null; function onDeviceReady(){ var options = { frequency:3000 }; watchID = navigator.geolocation.watchPosition(onSuccess,onError,options); } function onSuccess(position){ var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' + 'Longitude: '+ position.coords.longitude + '<br />' + '<hr />' + element.innerHTML; } function onError(error){ alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } </script> </head> <body> <p id="geolocation">Watching geolocation...</p> </body> </html>