MUI获取当前城市
1.manifest.json里配置模块权限配置添加android.permission.ACCESS_FINE_LOCATION 权限2.代码实例:
mui.plusReady(function() {
plus.geolocation.getCurrentPosition(translatePoint, function(e) {
mui.toast("异常:" + e.message);
});
});
function translatePoint(position) {
var currentLon = position.coords.longitude;
var currentLat = position.coords.latitude;
var city = position.address.city;
console.log("我当前所在的城市是:"+city);
}
高级例子:百度地图定位
**** Hidden Message *****
页:
[1]