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

Repeated continuous location updates

Open Brunocolaco opened this issue 2 years ago • 4 comments

Your Environment

  • Plugin version: 4.12.1
  • Platform: iOS or Android: Android
  • OS version: Android 13
  • Device manufacturer / model: Android Emulator
  • React Native version (react-native -v): 0.69.3
  • Plugin config
{"activityType": 1, "allowIdenticalLocations": false, "autoSync": true, "autoSyncThreshold": 0, "backgroundPermissionOptionLabel": "Permitir o tempo todo", "backgroundPermissionRationale": {"message": "Para rastrear sua atividade em segundo plano, ative a permissão {backgroundPermissionOptionLabel} Permissão de localização", "negativeAction": "Cancelar", "positiveAction": "Alterar para {backgroundPermissionOptionLabel}", "text": "undefined", "title": "Permitir que {applicationName} acesse a localização deste dispositivo em segundo plano?"}, "batchSync": true, "debug": false, "deferTime": 0, "desiredAccuracy": 2, "desiredOdometerAccuracy": 100, "disableElasticity": false, "disableLocationAuthorizationAlert": false, "disableMotionActivityUpdates": false, "disableStopDetection": false, "distanceFilter": 500, "elasticityMultiplier": 1, "enableHeadless": false, "extras": {"timezone": "America/Sao_Paulo"}, "fastestLocationUpdateInterval": 10000, "foregroundService": true, "geofenceInitialTriggerEntry": true, "geofenceModeHighAccuracy": false, "geofenceProximityRadius": 1000, "geofenceTemplate": "", "headers": {"Sessao": "32589aa94fa542d8b5564353e3961213"}, "heartbeatInterval": 60, "httpRootProperty": "posicoes", "locationTemplate": "", "locationUpdateInterval": 1000, "locationsOrderDirection": "ASC", "logLevel": 5, "logMaxDays": 2, "maxBatchSize": 100, "maxDaysToPersist": 1, "maxRecordsToPersist": -1, "notification": {"smallIcon": "drawable/icon", "text": "Iniciado e funcionando", "title": "MultiBus"}, "params": {"clienteMultisoftware": 190, "codigoViagem": 21796}, "preventSuspend": true, "showsBackgroundLocationIndicator": false, "startOnBoot": true, "stationaryRadius": 25, "stopAfterElapsedMinutes": 0, "stopDetectionDelay": 0, "stopOnStationary": false, "stopOnTerminate": false, "stopTimeout": 5, "url": <server_url>, "useSignificantChangesOnly": false}

Expected Behavior

We want the data to be sent only when the device is moving and that the same positions are not sent

Actual Behavior

O aparelho acaba por enviar diversas vezes a mesma localização para o servidor, mesmo com o aparelho parado.

Steps to Reproduce

  1. Initialise the plugin
  2. Call the SDK Start Tracking method.
  3. Log the location, and see BackgroundGeolocation.onHttp many request and the same position many times.

Context

We are trying to find out why the device is sending the same location several times to the url

Brunocolaco avatar Sep 04 '23 15:09 Brunocolaco

See wiki “Debugging”. Learn to observe native logs from the plug-in. The answer is there.

christocracy avatar Sep 04 '23 15:09 christocracy

What I need to know is if there is any reason for the lib to continue sending previous locations where the device has already passed but which it continues to send, I had up to 2000 identical positions

Brunocolaco avatar Sep 11 '23 13:09 Brunocolaco

You're probably doing something wrong and the answer is in the logs.

For example, this would create an infinite loops and generate thousands of locations:

BackgroundGeolocation.onLocation((location) => {
  BackgroundGeolocation.getCurrentPosition({});
});

christocracy avatar Sep 11 '23 13:09 christocracy

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

github-actions[bot] avatar May 04 '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 19 '24 01:05 github-actions[bot]