首页 > 解决方案 > 当应用程序处于后台或使用 mauron85/react-native-background-geolocation 关闭时,当应用程序进入静止状态时,服务器上的位置不会更新

问题描述

当应用程序处于前台或在用户移动时发送到后台时位置更新正确,但如果应用程序在应用程序关闭或后台位置停止更新时进入静止区域。即使我在应用程序从后台进入静止区域或终止状态后移动距离,它也不会退出静止区域并停止更新服务器上的位置。

环境:

React Native version: 0.59.9
Plugin version: 0.6.3
Platform: Android
OS version: 7
Device manufacturer and model: Redmi Note 4

插件配置选项:

BackgroundGeolocation.configure({
      desiredAccuracy: 10,
      stationaryRadius: 10,
      distanceFilter: 5,
      notificationTitle: 'Background Tracking',
      notificationText: 'Enabled',
      debug: true,
      startOnBoot: true,
      stopOnTerminate: false,
      locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
      interval: 5000,
      url: url,
      syncUrl: url,
      httpHeaders: {
        ...this.props.headers
      },
      postTemplate: {
        lat: '@latitude',
        long: '@longitude',
        id: id // you can also add your own properties`
      }
    })

标签: androidreact-nativebackgroundgeolocation

解决方案


推荐阅读