This code crashes the emulator, can anyone tell me why? <!DOCTYPE HTML> <html> <head> <title>PhoneGap</title> <script type="text/javascript" src="cordova-1.6.1.js"></script> <script type="text/javascript"> /** Called when phonegap javascript is loaded */ function onDeviceReady(){ navigator.geolocation.getCurrentPosition(onSuccess, onError, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }); }
function onSuccess(position) { document.getElementById('latitude').innerHTML = position.coords.latitude; document.getElementById('longitude').innerHTML = position.coords.longitude; document.getElementById('altitude').innerHTML = position.coords.altitude; document.getElementById('timestamp').innerHTML = new Date(position.timestamp); } function onError(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } /** Called when browser load this page*/ function init(){ document.addEventListener("deviceready", onDeviceReady, false); } </script> </head> <body onLoad="init()"> <h1>GeoLocation</h1> <table border="1"> <tr> <td>Latitue</td> <td id="latitude"></td> <tr> <tr> <td>Longitude</td> <td id="longitude"></td> <tr> <tr> <td>Altitude</td> <td id="altitude"></td> <tr> <tr> <td>Timestamp</td> <td id="timestamp"></td> <tr> </table> </ul> </body> </html> I was running this together with the http://tramper.co.nz/?5613 gpx file... not getting this to work -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en