React Native Background Geolocation静止不工作



我正在使用https://github.com/mauron85/react-native-background-geolocation并且静止不起作用。我的提供商是DISTANCE_FILTER_provider,我遵循代码

BackgroundGeolocation.on('stationary', (stationaryLocation) => {
// handle stationary locations here
console.log(stationaryLocation, 'STATIONARY')
});

但console.log中没有显示任何内容,删除了BackgroundGeolocation.on('location',(location(=>{}(并且它显示了静止的。这是怎么发生的?有人能教我如何使用文具吗。我正在自动暂停中使用它。我感谢你的帮助,谢谢你。

尝试使用此代码。

将其添加到您的配置对象中

stationaryRadius: 50

当你使用console.log并且你需要添加一个字符串变量时,你需要连接+号

BackgroundGeolocation.on('stationary', (stationaryLocation) => {
// handle stationary locations here
console.log(stationaryLocation + "STATIONARY")
});

或者尝试使用进行日志记录

最新更新