在安卓端测试的时候,
前台获取用户位置,一切正常
后台挂起时,获取不到位置
相关代码
this.interval = setInterval(function(){
uni.getLocation({
type: 'gcj02',
//altitude:true,
success: function (res) {
//发送数据到后台
that.sendLatLonLocation(res.latitude, res.longitude, res, that.userNo);
},
fail:function(res){
//发送数据到后台
that.sendLatLonLocation(JSON.stringify(res).substring(0,2000), '', res, that.userNo);
}
});
}, 1000) //每隔1秒执行一次
uni 可以实现实时定位用户数据吗?或者说uni现在支持调用原生安卓和ios的代码吗?这一块改怎么实现?请指教,谢谢!
00:01:47.835 thirdScriptError
00:01:47.855 01:47.826 11138 11138 I console : Maximum call stack size exceeded;at App onError function;at api getLocation success callback function
00:01:47.876 01:47.826 11138 11138 I console : RangeError: Maximum call stack size exceeded
00:01:47.937 01:47.826 11138 11138 I console : at Vue$3.setCacheTravelLatlon (uni-app:///pages/main/main.vue?c105:133:34)
00:01:47.978 01:47.826 11138 11138 I console : at Vue$3.setCacheTravelLatlon (uni-app:///pages/main/main.vue?c105:135:10)
00:01:48.019 01:47.826 11138 11138 I console : at Vue$3.setCacheTravelLatlon (uni-app:///pages/main/main.vue?c105:135:10)
00:01:48.060 01:47.826 11138 11138 I console : at Vue$3.setCacheTravelLatlon (uni-app:///pages/main/main.vue?c105:135:10)
[已删除] (作者)
安卓
2018-11-27 13:20
DCloud_UNI_GSQ
你说的挂起是指的什么?是关闭了应用吗?
2018-11-27 14:33
[已删除] (作者)
回复 DCloud_UNI_GSQ:不是关闭应用,是按了home键,回到主页,
2018-11-27 21:43