react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Transition between stationary and moving states

Open Crysp opened this issue 1 year ago • 3 comments

Your Environment

  • Plugin version: 4.12.1
  • Platform: iOS
  • OS version: 16
  • Device manufacturer / model: iPhone X
  • React Native version (react-native -v): 0.72.0
  • Plugin config
{
  startOnBoot: true,
  stopOnTerminate: false,
  enableHeadless: true,
  autoSync: false,
  url: SAVE_POSITION_URL,
  showsBackgroundLocationIndicator: false,
  desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION,
  persistMode: BackgroundGeolocation.PERSIST_MODE_ALL,
  distanceFilter: 10,
  locationTemplate:
    '{ "location": { "coords": { "latitude": <%= latitude %>, "longitude": <%= longitude %>, "accuracy": <%= accuracy %>, "speed": <%= speed %>, "heading": <%= heading %>, "altitude": <%= altitude %>, "altitude_accuracy": <%= altitude_accuracy %> } }, "activity": { "type": "<%= activity.type %>", "confidence": <%= activity.confidence %> }, "battery": { "level": <%= battery.level %>, "is_charging": <%= battery.is_charging %> }, "odometer": <%= odometer %>, "timestamp": "<%= timestamp %>", "event": "<%= event %>", "is_moving": <%= is_moving %>, "mock": <%= mock %>, "uuid": "<%= uuid %>" }',
  disableLocationAuthorizationAlert: true,
  logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
}

Expected Behavior

Invoke onMotionChange callback when exit stationary state and when enter moving state. Location attribute is_moving should be true along the way.

Actual Behavior

It detects moving after 300-500 meters and sometimes does not detect moving at all. And does not detect shortstop (20 minutes). And almost all locations emit with flag is_moving: false all along the way.

  • Why is "is_moving: false" all the way?
  • Why does it not recognize stop?
  • How can I improve this recognition?

Attach my last walk logs (moving 14:22 - 14:38, stop 14:38 - 15:01, moving 15:01 - 15:18)

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          44.470346696702364,
          40.189530276868254
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          44.4621840008472,
          40.18860175785693
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          [
            44.47034819515986,
            40.18981792441849
          ],
          [
            44.46818680560398,
            40.18973859182407
          ],
          [
            44.46846590395566,
            40.19071040971096
          ],
          [
            44.46843345065835,
            40.19098806940656
          ],
          [
            44.46282541740669,
            40.1905624030679
          ],
          [
            44.462318056887256,
            40.1904142128908
          ],
          [
            44.46215391083675,
            40.190095032947426
          ],
          [
            44.46204945425856,
            40.1886131063921
          ]
        ],
        "type": "LineString"
      }
    }
  ]
}

Context

I'm trying to detect two points: begin moving and stop somewhere. I'm using the onMotionChange method for this, but it works very unstable.

Debug logs

Full logs are too long to attach here. So I've create the gist.

Full logs — https://gist.github.com/Crysp/3b7963a15d012a2c04f2970b1eafc9c6

Crysp avatar Oct 29 '23 14:10 Crysp

@christocracy is it depends on distanceFilter value? I noticed that with distanceFilter: 0 it works much more accurate

Crysp avatar Nov 10 '23 12:11 Crysp

See API docs Configuration.transitorAuthorizationToken to have your app post its data to the demo server at https://tracker.transistorsoft.com

Post the orgname you chose so that I can view the data.

Config.distanceFilter has no effect on triggering.

christocracy avatar Nov 10 '23 14:11 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 02 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 16 '24 01:05 github-actions[bot]