Skip to content

[Help Wanted]: useKalman: true causes odometer to stay at 0.0 — correct config to reduce stationary GPS jitter on odometer? #1660

@FerAHMw

Description

@FerAHMw

Required Reading

  • Confirmed

Plugin Version

5.0.5

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Samsung A36, iPhone 17 pro, iPhone 13, Honor 8 lite

Device operating-systems(s)

Android 15, IOS 26.3

What do you require assistance about?

We recently migrated from v4 to v5 (5.0.5). After extensive testing, we found that useKalman: true causes
location.odometer to always return 0.0, regardless of actual movement.

Our goal: Reduce GPS jitter accumulation on the odometer when the device is stationary. During a 20-minute stationary period, the odometer accumulated ~70m of false distance due to GPS drift, even with good accuracy readings (6-8m).

What we tested (5 tests on Samsung A36, Android 15):

Test useKalman odometerUseKalmanFilter maxImpliedSpeed Odometer Tracking
1 not set (default true) not set (default true) not set 0.0 always Poor (12 points in 6h)
2 false (explicit) false (explicit) not set 0.0 always Better (22 points)
3 false false not set Working Working
4 true false 60.0 0.0 always Degraded
5 false true 60.0 Working Working

Key findings:

  • useKalman: true breaks location.odometer completely (always 0.0), even when odometerUseKalmanFilter: false
  • odometerUseKalmanFilter: true works correctly when useKalman: false
  • Tests 1 and 2 both had odometer=0 because v5 defaults useKalman to true — we initially didn't realize omitting theparameter meant Kalman was still active

Our questions:

  1. Is useKalman: true expected to affect location.odometer even when odometerUseKalmanFilter is set independently?The documentation says they are independent Kalman instances.
  2. What is the recommended configuration to minimize stationary GPS jitter on odometer while keeping accurate tracking? Specifically, is there a way to prevent odometer accumulation when isMoving: false?
  3. Is this a bug in 5.0.5 that useKalman: true zeroes out the odometer?

[Optional] Plugin Code and/or Config

bg.BackgroundGeolocation.ready(bg.Config(
    reset: true,
    geolocation: bg.GeoConfig(
      desiredAccuracy: bg.DesiredAccuracy.navigation,
      distanceFilter: Platform.isIOS ? 100 : 50,
      stopTimeout: 5,
      geofenceModeHighAccuracy: true,
      disableElasticity: false,
      elasticityMultiplier: Platform.isIOS ? 1.5 : 1,
      useSignificantChangesOnly: false,
      disableLocationAuthorizationAlert: true,
      locationAuthorizationRequest: 'Always',
      showsBackgroundLocationIndicator: true,
      filter: bg.LocationFilter(
        odometerAccuracyThreshold: 100,
        useKalman: false,            // true breaks odometer
        odometerUseKalmanFilter: true,
        maxImpliedSpeed: 60.0,
      ),
    ),
    activity: bg.ActivityConfig(
      activityRecognitionInterval: 0,
      stopOnStationary: false,
      disableStopDetection: false,
      triggerActivities: 'on_foot, walking, running, in_vehicle, on_bicycle',
    ),
    http: bg.HttpConfig(
      url: API_URL,
      method: 'POST',
      autoSync: true,
      batchSync: true,
      maxBatchSize: 1,
    ),
    app: bg.AppConfig(
      schedule: schedule,
      stopOnTerminate: false,
      startOnBoot: true,
      enableHeadless: true,
      heartbeatInterval: 300,
    ),
    logger: bg.LoggerConfig(
      debug: false,
      logLevel: bg.LogLevel.error,
    ),
  ));

[Optional] Relevant log output

bg.BackgroundGeolocation.ready(bg.Config(
    reset: true,
    geolocation: bg.GeoConfig(
      desiredAccuracy: bg.DesiredAccuracy.navigation,
      distanceFilter: Platform.isIOS ? 100 : 50,
      stopTimeout: 5,
      geofenceModeHighAccuracy: true,
      disableElasticity: false,
      elasticityMultiplier: Platform.isIOS ? 1.5 : 1,
      useSignificantChangesOnly: false,
      disableLocationAuthorizationAlert: true,
      locationAuthorizationRequest: 'Always',
      showsBackgroundLocationIndicator: true,
      filter: bg.LocationFilter(
        odometerAccuracyThreshold: 100,
        useKalman: false,            // true breaks odometer
        odometerUseKalmanFilter: true,
        maxImpliedSpeed: 60.0,
      ),
    ),
    activity: bg.ActivityConfig(
      activityRecognitionInterval: 0,
      stopOnStationary: false,
      disableStopDetection: false,
      triggerActivities: 'on_foot, walking, running, in_vehicle, on_bicycle',
    ),
    http: bg.HttpConfig(
      url: API_URL,
      method: 'POST',
      autoSync: true,
      batchSync: true,
      maxBatchSize: 1,
    ),
    app: bg.AppConfig(
      schedule: schedule,
      stopOnTerminate: false,
      startOnBoot: true,
      enableHeadless: true,
      heartbeatInterval: 300,
    ),
    logger: bg.LoggerConfig(
      debug: false,
      logLevel: bg.LogLevel.error,
    ),
  ));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions