Skip to content

[Bug]: BackgroundGeolocation repeatedly posts stale location instead of current coordinates When #1674

@KyungRyul

Description

@KyungRyul

Required Reading

  • Confirmed

Plugin Version

5.1.2

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.35.2, on macOS 15.6 24G84 darwin-arm64, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.1.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] Connected device (3 available)
[✓] Network resources

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Galaxy S20, iPhone 12

Device operating-systems(s)

iOS 26.1, Anroid 13

What happened?

When the user is moving, location updates are successfully posted to the server. However, after some time, when a new location should be sent, the plugin repeatedly posts an old coordinate from a previously visited location instead of the user's current position.

For example:

The user moves from Point A to Point B to Point C.
Initially, the server receives the correct coordinates.
Later, instead of sending the current location, it continuously sends the coordinates of a past location (such as Point B), even though the user has already moved elsewhere.

Plugin Code and/or Config

bg.BackgroundGeolocation.ready(bg.Config(
      geolocation: bg.GeoConfig(
        desiredAccuracy: bg.DesiredAccuracy.high,
        distanceFilter: 30,
        deferTime: 3000,
        pausesLocationUpdatesAutomatically: false,
        geofenceModeHighAccuracy: true,
        useSignificantChangesOnly: Platform.isIOS,
        fastestLocationUpdateInterval: 60000,
        locationUpdateInterval: 300000,
        locationAuthorizationRequest: 'Always',
        locationAuthorizationAlert: {},
      ),
      app: bg.AppConfig(
        preventSuspend: true,
        heartbeatInterval: 600,
        stopOnTerminate: false,
        startOnBoot: true,
        enableHeadless: true,
        notification: bg.Notification(),
        backgroundPermissionRationale: bg.PermissionRationale(),
      ),
      http: bg.HttpConfig(
        url: "${Constants.url}/api/user_position",
        params: {"uid": _auth.currentUser!.uid},
        headers: {"Content-Type": "application/json"},
        rootProperty: 'data',
      ),
      activity: bg.ActivityConfig(),
    )).then((bg.State state) {
      if (!state.enabled) {
        bg.BackgroundGeolocation.start();
      }
    });

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions