app息屏后在定时器中使用uni.getLocation获取不到不报错也不进入success和fail
setInterval(() => {uni.getLocation()},30000)

1***@qq.com
- 发布:2024-04-11 17:02
- 更新:2024-04-11 17:20
- 阅读:516



爱豆豆 - 办法总比困难多
你这个循环调用uni.getLocation获得持续定位的方案不行的
需要app后台保活 和 uni.onLocationChange搭配 才能做到持续获取定位的效果
文档中也有解释的
保活插件:https://ext.dcloud.net.cn/search?q=%E4%BF%9D%E6%B4%BB&cat1=5
uni.onLocationChange文档:https://uniapp.dcloud.net.cn/api/location/location-change.html
1***@qq.com (作者)
好的 谢谢
2024-04-11 18:07
2***@qq.com
回复 1***@qq.com: 请这个问题你解决了吗
2024-10-07 10:59