遇到的问题:开发一个上报地理位置的小程序,打包成体验版在ios下测试;调用startLocationUpdateBackground接口后,在onLocationChange中可以正常获得数据,除了speed一直返回-1。有哪位大神知道问题在哪里吗?
var that=this;
success: function () { console.info("持续定位初始化成功"); wx.onLocationChange(function (res) { console.info('[' + util.formatTime(new Date()) + ']位置改变:', res); that.setData({ currentLongitude: res.longitude, currentLatitude: res.latitude, speed: res.speed, altitude: res.altitude }); that.doReport(); }) }, fail: function () { console.info("持续定位初始化失败"); wx.getSetting({ success(res) { if (res.authSetting["scope.userLocationBackground"] != true ){ wx.showModal({ title: '提示', content: '您需要允许(使用小程序期间和离开小程序后)选项', success: function (res) { if (res.confirm) { //这里是点击了确定以后 wx.openSetting({ success(res) { that.doMain(); }, fail: function () { console.info("打开设置失败") } }); } else { //这里是点击了取消以后 //console.log('用户点击取消') } } }) } else { console.info("未知错误"); } } }) }}) |

你好 speed为-1的问题解决了吗
锁屏下:
谢谢,你的代码对我有用。
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
小米MIX3 锁屏下的情况 startLocationUpdateBackground 返回的定位不准 (错乱),而且间隔很大。
黑鲨1 锁屏下的情况下 可以正常。
iphone 11 锁屏下的情况下也可以正常
我刚试下了,也是返回-1