wx.getSetting({
success: res=>{
if (res.authSetting['scope.userLocation']) {
//用户已授权
this.getLocation();
} else{
//用户未授权
wx.authorize({
scope: 'scope.userLocation',
success: resSuc=>{
this.getLocation();
},
fail: errSuc => {
hud.hideLoading();
wx.showModal({
title: '提示',
content: '请前往设置打开位置权限',
success(reso) {
if(reso.confirm) {
wx.openSetting({
success(resn) {
}
})
} else {
}
}
})
}
})
}
}
})
getLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF"
使用流量的情況,安卓系統