Cordova 我在phonegap地理定位中获得(纬度,长)坐标而不使用互联网或GPS?
当我在phonegap geolocation中试用一个示例程序时。在我的三星pop中,没有互联网或GPS,我可以得到我当前位置的经纬度。我不知道当我的设备中的wifi和gps被禁用时,它是如何获取当前位置的坐标、高度和时间戳的。请帮帮我Cordova 我在phonegap地理定位中获得(纬度,长)坐标而不使用互联网或GPS?,cordova,geolocation,w3c-geolocation,Cordova,Geolocation,W3c Geolocation,当我在phonegap geolocation中试用一个示例程序时。在我的三星pop中,没有互联网或GPS,我可以得到我当前位置的经纬度。我不知道当我的设备中的wifi和gps被禁用时,它是如何获取当前位置的坐标、高度和时间戳的。请帮帮我 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org /TR/html4/loose.dtd"> <html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org /TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Locator</title>
<script type="text/javascript" charset="utf-8" src="../plugins/phonegap-1.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess,Error);
}
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude
+ '<br />' + 'Longitude: ' + position.coords.longitude
+ '<br />' + 'Accuracy: ' + position.coords.accuracy
+ '<br />' + 'Timestamp: ' + new Date(position.timestamp) + '<br />';
}
function onError(error) {
alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');
}
</script>
</head>
<body>
<p id="geolocation">
Finding geolocation...
</p>
</body>
</html>
我的定位器
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
函数ondevicerady(){
navigator.geolocation.getCurrentPosition(onSuccess,Error);
}
成功时的功能(位置){
var element=document.getElementById('geolocation');
element.innerHTML='纬度:'+position.coords.Latitude
+“
”+“经度:”+position.coords.Longitude
+“
”+”精度:“+position.coords.accurity
+“
”+”时间戳:“+新日期(position.Timestamp)+”
”;
}
函数onError(错误){
警报('code:'+error.code+'\n'+'消息:'+error.message+'\n');
}
正在查找地理位置。。。
“位置信息的常见来源包括全球定位系统(GPS)和从网络信号推断的位置,如IP地址、RFID、WiFi和蓝牙MAC地址以及GSM/CDMA小区ID。”
您将从web浏览器的地理定位API获取坐标。为此,它还需要wifi dude。。。。如果没有wifi或gps本身,我就获得了位置……你是否一直获得相同的坐标?