How to use the react-native-background-geolocation.configure function in react-native-background-geolocation

To help you get started, we’ve selected a few react-native-background-geolocation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github City-of-Helsinki / open-city-app / src / helpers / backgroundTask.js View on Github external
export function mountBackgroundTask(navigator) {
  _navigator = navigator;

  BackgroundGeolocation.configure({
    desiredAccuracy: 0,
    stationaryRadius: 100,
    distanceFilter: 500,
    locationUpdateInterval: 5000,
    minimumActivityRecognitionConfidence: 80,   // 0-100%.  Minimum activity-confidence for a state-change
    fastestLocationUpdateInterval: 5000,
    activityRecognitionInterval: 5000,
    stopDetectionDelay: 1,  // <--  minutes to delay after motion stops before engaging stop-detection system
    stopTimeout: 30, // 30 minutes
    activityType: 'Other',

    // Application config
    debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
    forceReloadOnLocationChange: false,  // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a new location is recorded (WARNING: possibly distruptive to user)
    forceReloadOnMotionChange: false,    // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when device changes stationary-state (stationary->moving or vice-versa) --WARNING: possibly distruptive to user)
    forceReloadOnGeofence: false,        // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a geofence crossing occurs --WARNING: possibly distruptive to user)