HBuilder的geolocation定位模块其实接口很少,通常我们使用定位模块即可。
var posi = null;
mui.plusReady(function() {
posi = plus.geolocation.getCurrentPosition( function ( p ) {
console.log( "Geolocation\nLatitude:" + p.coords.latitude + "\nLongitude:" + p.coords.longitude + "\nAltitude:" + p.coords.altitude );
console.log("street = " + p.address.street);
console.log("poiName = " + p.address.poiName);
console.log("coordsType = " + p.coordsType);
console.log("timestamp = " + p.timestamp);
console.log("addresses = " + p.addresses);
}, function ( e ) {
console.log( "Geolocation error: " + e.message );
},{enableHighAccuracy: true});
});
mui.back = function(){
var btn = ["确定","取消"];
mui.confirm('确认关闭当前窗口?','Hello MUI',btn,function(e){
if(e.index==0){
// 关闭位置监听 并返回
plus.geolocation.clearWatch( posi );
mui.currentWebview.close();
}
});
}
作者:zhuming3834 发表于2017/6/13 15:42:51 原文链接
阅读:44 评论:0 查看评论