function openWatching(provider){//开始定位
document.getElementById("provider").innerHTML = "provider:" + provider;
wid = plus.geolocation.watchPosition(function(p) {
var longitude = forDight(p.coords.longitude, 6);
var latitude = forDight(p.coords.latitude, 6);
var altitude = forDight(p.coords.altitude, 2);
var accuracy = forDight(p.coords.accuracy, 2);
document.getElementById("longitude").innerHTML = "经度:" + longitude;
document.getElementById("latitude").innerHTML = "纬度:" + latitude;
document.getElementById("altitude").innerHTML = "海拔:" + altitude +"米";
document.getElementById("accuracy").innerHTML = "定位精度:" + accuracy + "米";
document.getElementById("zuobiao").innerHTML = "座标系:" + p.coordsType;
time ++;
document.getElementById("time").innerHTML = "定位次数:" + time;
}, function(e) {
document.getElementById("longitude").innerHTML = "定位失败!";
document.getElementById("latitude").innerHTML = "";
document.getElementById("altitude").innerHTML = "";
}, {enableHighAccuracy:true, maximumAge:2000, provider:provider});
}
在真机运行时,安卓、苹果在alpha版本中正常。
alpha打包后,苹果正常,安卓永远是bd09ll。。。。