let systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === "android") {
let systemSetting = uni.getSystemSetting()
if (systemSetting.locationEnabled === true) {
uni.getLocation({
type: 'wgs84', //返回可以用于uni.openLocation的经纬度
success: (res)=> {
uni.onLocationChange((res)=>{
console.log(res)
})
}
});
// uni.showModal({
// title: '提示',
// content: '是否同意打开GPS定位',
// success: function (res) {
// if (res.confirm) {
// uni.openAppAuthorizeSetting()
// }
// }
// });
}
} else {
console.log(777)
}调用uni.onLocationChange((res)=>{
console.log(res)
})的时候is not a function坐等领导提醒
5***@qq.com (作者)
谢谢,疏忽了,没看版本要求,这给我整的折腾了一晚上,还以为要自己重写wx.onlocationchenge呢
2022-12-02 21:25