Skip to content

MotionChangeEvent

Motion-state change delivered to BackgroundGeolocation.onMotionChange.

The SDK fires this event each time it transitions between the moving and stationary states. A location is always recorded at the moment of transition.

BackgroundGeolocation.onMotionChange((MotionChangeEvent event) {
  if (event.isMoving) {
    print('[onMotionChange] Device is moving: ${event.location}');
  } else {
    print('[onMotionChange] Device is stationary: ${event.location}');
  }
});