网友回复
从基础库 2.8.0 开始支持后台获取定位数据变化提醒,低版本需做兼容处理。
调用前需要 用户授权 scope.userLocationBackground在app.json中添加以下配置项
{
"pages": ["pages/index/index"],
"requiredBackgroundModes": [
"location"
]
}
这相当于你给用户了“使用小程序期间和离开小程序后”这个选项。
2.2.查看用户权限
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userLocationBackground']) {
wx.authorize({
...点击查看剩余70%


