Javascript Cordova/PhoneGap中的坐标录制会产生奇数结果。我的手机和GPS卫星有什么关系吗?
编辑-我使用 我从这些手机上取下密码,挂上电话,绕着街区转了一圈: 以下是代码(几乎没有修改): 和我看到的几点有关吗?GPS卫星是否有某种“砰”的一声,通过它可以回到手机上Javascript Cordova/PhoneGap中的坐标录制会产生奇数结果。我的手机和GPS卫星有什么关系吗?,javascript,android,cordova,google-maps,geolocation,Javascript,Android,Cordova,Google Maps,Geolocation,编辑-我使用 我从这些手机上取下密码,挂上电话,绕着街区转了一圈: 以下是代码(几乎没有修改): 和我看到的几点有关吗?GPS卫星是否有某种“砰”的一声,通过它可以回到手机上 <!DOCTYPE html> <html> <head> <title>Device Properties Example</title> <script type="text/javascript" charset="utf-8"
<!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="utf-8">
// Wait for device API libraries to load
//
// document.addEventListener("deviceready", onDeviceReady, false);
var watchID = null;
// device APIs are available
//
function onDeviceReady() {
// Get the most accurate position updates available on the
// device.
var options = { maximumAge: 3000, timeout: 10000, enableHighAccuracy: true };
navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
}
// onSuccess Geolocation
//
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = position.coords.latitude + ',' + position.coords.longitude +
'<hr />' + element.innerHTML;
}
// clear the watch that was started earlier
//
function clearWatch() {
alert('STOPPING!');
if (watchID != null) {
navigator.geolocation.clearWatch(watchID);
watchID = null;
}
}
// onError Callback receives a PositionError object
//
function onError(error) {
var element = document.getElementById('geolocation');
element.innerHTML = '<h1 style="color:red;">ERRORED!</h1>' +
'<hr />' + element.innerHTML;
}
</script>
</head>
<body>
<button onclick="clearInterval(intervalio);alert('I WIN', 'SHOULD HAVE STOPPED')" style="color:red;font-size:25px;">STOP RECORDING YOU TARD</button>
<script type="text/javascript">
intervalio = setInterval(function() {
onDeviceReady();
}, 1000);
</script>
<p id="geolocation">Watching geolocation...</p>
<button onclick="ondeviceReady();" style="color:green;font-size:25px;">STOP YOU IDIOT</button>
</body>
</html>
var options = { maximumAge: 3000, timeout: 10000, enableHighAccuracy: true };