react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Repeated continuous location updates
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
- Initialise the plugin
- Call the SDK Start Tracking method.
- 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
See wiki “Debugging”. Learn to observe native logs from the plug-in. The answer is there.
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
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({});
});
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.