转:https://blog.csdn.net/qaqqmq/article/details/79151610
希望对大家有用,
mui.plusReady(function() {
plus.geolocation.getCurrentPosition(MapPoint, function(e) {
mui.toast("error:" + e.message);
})
})
function MapPoint(position) {
var Lon = position.coords.longitude; //获取经度
var Lat = position.coords.latitude; //获取纬度
var address = "当前地址:" + position.address.province + "," + position.address.city + "," + position.address.district + "," + position.address.street + "," + position.address.streetNum;
alert(Lon + "," + Lat);
alert(address);
}
打包APK时,需要去百度或者高德申请appkey,这样打包后就不会出现获取不了地址的问题了。