另外,打开手机,从运行程序列表中调出小程序,就报这个错误cmdid 1005,errCode -2[图片]
在后台运行获取GPS信息,10几分钟后,就被杀死,是怎么回事儿下面的代码近乎没什么逻辑,但运行10几分钟后,就被杀掉了是怎么回事儿? 手机:一加5 app.json里设置了: "requiredBackgroundModes":["location"], "permission":{ "scope.userLocation":{ "desc""你的位置信息将用于 GPS信息获取" } } wx.startLocationUpdateBackground({ success:function(res){ var dateline = Date.now(); dateline = util.formatTime(newDate(dateline)); var msg = dateline + ' 开启持续定位,成功' textContent.unshift(msg); thisPage.setData({ textContent: textContent }); wx.onLocationChange(function (res) { var dateline = Date.now(); dateline = util.formatTime(newDate(dateline)); var msg = dateline+" 纬度:" + res.latitude + "\n经度:" + res.longitude + ',速度:' + res.speed + ',高度:' + res.altitude; console.log(msg); if (textContent.length >= 50) textContent.pop(); textContent.unshift(msg); thisPage.setData({ textContent: textContent }); }) }, fail: function (res){ var dateline = Date.now(); dateline = util.formatTime(newDate(dateline)); var msg = dateline + ' 开启持续定位,失败' textContent.unshift(msg); thisPage.setData({ textContent: textContent }); } }) },
2019-12-23