flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

I'm getting more than 3 location updates

Open ivangoluuk opened this issue 3 years ago • 1 comments

I have the following issue.

so when I enable the updates (BackgroundGeolocation.start()) I receive 3 or more location data from the location callback

Your Environment

  • Plugin version: 4.8.7
  • Platform: Android
  • OS version:
  • Device manufacturer / model:
  • Flutter info (flutter doctor):
  • Plugin config:
 bg.BackgroundGeolocation.ready(
      bg.Config(
        reset: true,
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
        distanceFilter: 0,
        locationUpdateInterval: 10000,
        stopOnTerminate: true,
        startOnBoot: true,
        debug: false,
        allowIdenticalLocations: true,
        logLevel: bg.Config.LOG_LEVEL_VERBOSE,
        locationAuthorizationRequest: 'Always',
        backgroundPermissionRationale: bg.PermissionRationale(
          title:
              "Permitir a {applicationName} acceder a la ubicación de este dispositivo, incluso cuando la app esté en segundo plano.",
          message:
              "{applicationName} recopila datos de ubicación para habilitar la asignación autómatica de pedidos, soporte en ruta y el registro de entrega de pedidos incluso cuando la aplicación está en segundo plano.",
          positiveAction: 'Cambiar a "{backgroundPermissionOptionLabel}"',
          negativeAction: 'Cancelar',
        ),
      ),
    ).then((bg.State state) {
      _enabled = state.enabled;
      _isMoving = state.isMoving ?? false;
    });

Expected Behavior

I just want to receive one update no more.

Actual Behavior

I'm receiving more location updates

Steps to Reproduce

  1. use bg.BackgroundGeolocation.start() then
  2. bg.BackgroundGeolocation.stop()
  3. bg.BackgroundGeolocation.start()

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
Captura de pantalla 2023-03-28 a la(s) 14 54 25 Captura de pantalla 2023-03-28 a la(s) 14 54 38

2 updates at the same time

Captura de pantalla 2023-03-28 a la(s) 15 06 18 Captura de pantalla 2023-03-28 a la(s) 15 06 31

ivangoluuk avatar Mar 28 '23 20:03 ivangoluuk

That’s not at all unusual.

the plug-in doesn’t just request one location when you call .start(), the plug-in will “sample” up to 5 locations. See api docs Location.sample.

the final location settled upon is fired to the onMotionChange event (see api docs).

christocracy avatar Mar 28 '23 21:03 christocracy