transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.62k stars 428 forks source link

RNBG doesn't send data to server after internet connection was lost and then restored. #2093

Closed vladbelozertsev closed 1 month ago

vladbelozertsev commented 1 month ago

Your Environment

Expected Behavior

  1. Internet connection was lost
  2. Internet connection restored
  3. RNBG send data to server.

Actual Behavior

RNBG can't track that inet connection restored, and network is false. But connection is available, i can send some messages, open websites and so on.

I have read this issue and another one. Is there any solution how i can fix it? Can i restart/refresh plugin or else?

Debug logs

Logs ``` 07-20 02:57:53.384 DEBUG [TSSQLiteAppender$c run] ℹ️ Cleared logs older than 72 hours 07-20 02:57:53.384 DEBUG [LoggerFacade$a a] ℹ️ Persist config, dirty: [] 07-20 02:58:13.051 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [autoSyncThreshold, backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, batchSync, debug, desiredAccuracy, distanceFilter, headers, locationTemplate, logLevel, startOnBoot, stopOnTerminate, url] 07-20 02:58:13.109 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 07-20 02:58:13.752 DEBUG [LifecycleManager onPause] ☯️ onPause 07-20 02:58:16.462 DEBUG [LifecycleManager onResume] ☯️ onResume 07-20 02:58:42.829 DEBUG [LifecycleManager onPause] ☯️ onPause 07-20 02:58:43.216 DEBUG [LifecycleManager onStop] ☯️ onStop 07-20 02:58:57.692 DEBUG [TSSQLiteAppender$c run] ℹ️ Cleared logs older than 72 hours 07-20 02:58:57.692 INFO [LoggerFacade$a a] ╔═════════════════════════════════════════════ ║ TSLocationManager version: 3.5.1 (430) ╠═════════════════════════════════════════════ ╟─ Xiaomi M2103K19Y @ 13 (react) { "activityRecognitionInterval": 10000, "allowIdenticalLocations": false, "authorization": {}, "autoSync": true, "autoSyncThreshold": 10, "backgroundPermissionRationale": { "title": "{applicationName} ilovasiga fonda ushbu qurilma joylashuviga kirishiga ruxsat berilsinmi?", "message": "Yuk harakatini kuzatish uchun dastur tegishli ruxsatni talab qiladi", "positiveAction": "ga o'zgartirish {backgroundPermissionOptionLabel}", "negativeAction": "Bekor qilish" }, "batchSync": true, "configUrl": "", "debug": true, "deferTime": 0, "desiredAccuracy": -1, "desiredOdometerAccuracy": 100, "disableAutoSyncOnCellular": false, "disableElasticity": false, "disableLocationAuthorizationAlert": false, "disableMotionActivityUpdates": false, "disableProviderChangeRecord": false, "disableStopDetection": false, "distanceFilter": 100, "elasticityMultiplier": 1, "enableHeadless": false, "enableTimestampMeta": false, "extras": {}, "fastestLocationUpdateInterval": -1, "foregroundService": true, "geofenceInitialTriggerEntry": true, "geofenceModeHighAccuracy": false, "geofenceProximityRadius": 1000, "geofenceTemplate": "", "headers": { "Authorization": "" }, "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask", "heartbeatInterval": -1, "httpRootProperty": "location", "httpTimeout": 60000, "isMoving": false, "locationAuthorizationRequest": "Always", "locationTemplate": "{\"lat\":<%= latitude %>,\"long\":<%= longitude %>,\"time\":\"<%= timestamp %>\"}", "locationTimeout": 60, "locationUpdateInterval": 1000, "locationsOrderDirection": "ASC", "logLevel": 5, "logMaxDays": 3, "maxBatchSize": -1, "maxDaysToPersist": 1, "maxMonitoredGeofences": 97, "maxRecordsToPersist": -1, "method": "POST", "minimumActivityRecognitionConfidence": 75, "motionTriggerDelay": 0, "notification": { "layout": "", "title": "", "text": "Location Service activated", "color": "", "channelName": "TSLocationManager", "channelId": "", "smallIcon": "", "largeIcon": "", "priority": -1, "sticky": false, "strings": {}, "actions": [] }, "params": {}, "persist": true, "persistMode": 2, "schedule": [], "scheduleUseAlarmManager": false, "speedJumpFilter": 300, "startOnBoot": true, "stationaryRadius": 25, "stopAfterElapsedMinutes": 0, "stopOnStationary": false, "stopOnTerminate": false, "stopTimeout": 5, "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking", "url": "", "useSignificantChangesOnly": false, "enabled": false, "schedulerEnabled": false, "trackingMode": 1, "odometer": 0, "isFirstBoot": false, "didLaunchInBackground": false, "didDeviceReboot": false } 07-20 02:58:57.693 INFO [LoggerFacade$a a] ╔═════════════════════════════════════════════ ║ DEVICE SENSORS ╠═════════════════════════════════════════════ ╟─ ✅ ACCELEROMETER: {Sensor name="icm40607_acc", vendor="ICM", version=1, type=1, maxRange=78.453606, resolution=0.0012, power=0.001, minDelay=5000} ╟─ ✅ GYROSCOPE: {Sensor name="icm40607_gyro", vendor="ICM", version=1, type=4, maxRange=34.9063, resolution=0.0011, power=0.001, minDelay=5000} ╟─ ✅ MAGNETOMETER: {Sensor name="akm09918", vendor="AKM", version=1, type=2, maxRange=4912.0503, resolution=0.15, power=0.001, minDelay=20000} ╟─ ✅ SIGNIFICANT_MOTION: {Sensor name="SIGNIFICANT_MOTION", vendor="MTK", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.001, minDelay=-1} ╚═════════════════════════════════════════════ 07-20 02:58:57.795 DEBUG [LifecycleManager onCreate] ☯️ onCreate 07-20 02:58:57.796 DEBUG [LifecycleManager onStart] ☯️ onStart 07-20 02:58:57.796 DEBUG [LifecycleManager onResume] ☯️ onResume 07-20 02:58:57.796 INFO [BackgroundGeolocation ] ✅ Google Play Services: connected (version code:12451000) 07-20 02:58:57.808 INFO [TSProviderManager startMonitoring] 🎾 Start monitoring location-provider changes 07-20 02:58:57.818 DEBUG [SQLiteLocationDAO prune] ℹ️ PRUNE -1 days ```
vladbelozertsev commented 1 month ago

Additional information: i add debug log, but its look fine.

After some testing: i can login to the app and RNBG one time send location data to a server (internet connection is ok), but, after short period of time almost immediately (3-5 seconds) it shows that network is not available and stop send data to server. I noticed, there is something wrong with RNBG network, because device connection is available (i can open websites and so on). Is it possible somehow to make RNBG send data even the network is false? Or maybe some one knows another solution?

vladbelozertsev commented 1 month ago

Seems like it's start working few mins ago. If every thing will be ok, i will close this issue

vladbelozertsev commented 1 month ago

I notice strange behavior of the plugin - duplicate data is sent to the server. I will try to provide logs of the work in the near future.

christocracy commented 1 month ago

It’s not unusual. If you don’t like a particular location filter it out.

christocracy commented 1 month ago

Your issue is titled “ doesn't send data to server after internet connection was lost and then restored”: is this issue closed?

vladbelozertsev commented 1 month ago

Hi @christocracy, i need more time to get debug logs and understand what's going on.

Your issue is titled “ doesn't send data to server after internet connection was lost and then restored”: is this issue closed?

In our internal testing everything was fine, but bugs appeared in production. At first there were problems with the network. I don’t know exactly whether the connection was missing but then appeared again or whether there was no loss of connection at all. But I will note that there was a connection, but the plugin indicated the absence of a network and did not transmit data to server.

Now the plugin sends data to server, but for some reason the data is duplicated several times. It takes more time to get debug logs because... I need interaction with our remote employees.

vladbelozertsev commented 1 month ago

It’s not unusual. If you don’t like a particular location filter it out.

I don't understand what u mean, explain please. From documentation i noticed, that location points are stored in db, and remove from it after sync with server (after 200 response)

christocracy commented 1 month ago

If you have an unrelated issue, open a new issue. Issues are not open-ended, personal support threads for every problem.