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

Location stopped by android and ios after nearly exactly 2 hours

Open mbuttin opened this issue 1 year ago • 8 comments

I test this plugin for my app. What interseting me is the battery efficiency and the robust capacity to get location when app is in the background or screen is off. My app track location of the user for long walks, up to 5h. The app looks to work fine when fieldtesting it (ios still got some "gps jumps" that looks to be solved in android with speedJumpFilter), but suddenly after 2 hours (I can't get the exact time, but it should be really close from 2hrs), the app cease to get position on the 3 devices I was testing, at the same time (2 androids phones and 1 ios phone). When checking on the phones, I had to "restart" the app, but then, the geolocation didn't start again. So, is the problem from os that terminate the app after 2hrs ? Or is it something with the plugin ? And why the plugin didn't start again ? After a delay (testing again 2hrs after termination), when launching the app, the plugin start again.

Your Environment

  • Plugin version: v4.17.2
  • Platform: iOS or Android : both
  • OS version: Android : 14 ios : 15.7.9
  • Device manufacturer / model: samsung a53, iphone 7+
  • React Native version (react-native -v): 0.74.5
  • Plugin config
const state = await BackgroundGeolocation.ready({
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: parsedAccurate,
      fastestLocationUpdateInterval: 5000,
	  isMoving:true,
      preventSuspend: true,
	  heartbeatInterval: 300,
      foregroundService: true,
	  speedJumpFilter:100,
	  stopAfterElapsedMinutes: 300,
      //enableHeadless: true,
      stopTimeout: 10,
      maxRecordsToPersist: 0,
      disableElasticity: true,
      debug: true,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      stopOnTerminate: false,
      startOnBoot: false,
});

Expected Behavior

The app should continue to work after 2hrs. Bonus if there is a way to check periodically if app is terminated and relaunch it.

Actual Behavior

The app stop working after 2hrs

Steps to Reproduce

  1. Start the plugin 2.Get position for 2 hrs 3.No more position after 2hrs 4.Plugin didn't restart if app is relaunched. Note : on ios, I noticed that the last "notification" before the app stopped sending location was : "authorization status changed 3"

Context

Track position for long walks.

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

mbuttin avatar Oct 17 '24 07:10 mbuttin

See wiki “Debugging” and learn to fetch the plug-in log database using .emailLog (search the api docs).

the plug-in has no trouble tracking for an infinite time, regardless if stopped for any length of time. I’ve been field-testing daily for over 10 years.

here I am travelling throughout France in trains and cars for over 2 weeks this past summer:

https://www.transistorsoft.com/lab/france

christocracy avatar Oct 17 '24 12:10 christocracy

Ok, got it. As I uninstalled/reinstalled the app for other debugging purpose, I think that the log from that event have disappeared ? I'll do an other field test soon, and will post the logs if it appends again. Thx for support. Just for question : during you travel, did you keep the plugin active all time, or only start it before moving from place to place ? Let me know next time you stop to Lyon :)

mbuttin avatar Oct 17 '24 14:10 mbuttin

during you travel, did you keep the plugin active all time,

I had the demo app running. I always have the demo app running on my phones. I almost never interact with the app. The Android device was stuffed in my suitcase and never interacted with other than recharging.

Let me know next time you stop to Lyon :)

There’s some big hills in that city.

christocracy avatar Oct 18 '24 12:10 christocracy

Hi. I'm now trying to understand the debug logs. For example, here, I've ready/start the plugin at 11:51 and then I have a TrackingService stopped log (did nothing for that)... So it goes to heartbeat mode 5 min later but that does nothing, and then heartbeat again 5 min later (still nothing), and then at 12:02, this occurs : 10-19 12:02:01.650 DEBUG [LifecycleManager onStart] ☯️ onStart 10-19 12:02:01.656 DEBUG [LifecycleManager onResume] ☯️ onResume and then everything works fine for a while, get my position updates and could use them with my app.

Could you help me understand how to read those logs and what happened ? I should do something wrong... Why I got a trackingservice stop ? 10-19 11:51:01.953 DEBUG [AbstractService onDestroy] 🔴 LocationRequestService stopped 10-19 11:51:01.997 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(1): true 10-19 11:51:01.999 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 10-19 11:56:40.575 INFO [ScheduleEvent a]

And why does it restart "by itself" 11 minutes later ?

Here is the full log of that timeline :

10-19 11:50:59.109 INFO [LoggerFacade$a a] ╔═════════════════════════════════════════════ ║ TSLocationManager version: 3.5.5 (434) ╠═════════════════════════════════════════════ ╟─ Xiaomi M2101K7BNY @ 13 (react) { "activityRecognitionInterval": 10000, "allowIdenticalLocations": false, "authorization": {}, "autoSync": true, "autoSyncThreshold": 0, "backgroundPermissionRationale": { "title": "Permettre à {applicationName} d'accéder à votre localisation en arrière plan ?", "message": "Pour permettre le fonctionnement d'iMarshall, vous devez valider la permission {backgroundPermissionOptionLabel}", "positiveAction": "Modifier pour {backgroundPermissionOptionLabel}", "negativeAction": "Annuler" }, "batchSync": false, "configUrl": "", "crashDetector": { "enabled": false, "accelerometerThresholdHigh": 20, "accelerometerThresholdLow": 4.5, "gyroscopeThresholdHigh": 20, "gyroscopeThresholdLow": 4.5 }, "debug": true, "deferTime": 0, "desiredAccuracy": -1, "desiredOdometerAccuracy": 100, "disableAutoSyncOnCellular": false, "disableElasticity": true, "disableLocationAuthorizationAlert": false, "disableMotionActivityUpdates": false, "disableProviderChangeRecord": false, "disableStopDetection": false, "distanceFilter": 10, "elasticityMultiplier": 1, "enableHeadless": false, "enableTimestampMeta": false, "extras": {}, "fastestLocationUpdateInterval": 5000, "foregroundService": true, "geofenceInitialTriggerEntry": true, "geofenceModeHighAccuracy": false, "geofenceProximityRadius": 1000, "geofenceTemplate": "", "headers": {}, "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask", "heartbeatInterval": 300, "httpRootProperty": "location", "httpTimeout": 60000, "isMoving": true, "locationAuthorizationRequest": "Always", "locationTemplate": "", "locationTimeout": 60, "locationUpdateInterval": 1000, "locationsOrderDirection": "ASC", "logLevel": 5, "logMaxDays": 3, "maxBatchSize": -1, "maxDaysToPersist": 1, "maxMonitoredGeofences": 97, "maxRecordsToPersist": 0, "method": "POST", "minimumActivityRecognitionConfidence": 75, "motionTriggerDelay": 0, "notification": { "layout": "", "title": "iMarshall", "text": "iMarshall suit votre position pour permettre au club de golf d'optimiser le rythme de jeu. Votre position n'est pas enregistrée en dehors du périmètre du golf et les données ne sont pas stockées plus de 24h. Vos données ne sont communiquées à aucun autre utilisateur.", "color": "", "channelName": "TSLocationManager", "channelId": "", "smallIcon": "", "largeIcon": "", "priority": -1, "sticky": false, "strings": {}, "actions": [] }, "params": {}, "persist": true, "persistMode": 2, "schedule": [], "scheduleUseAlarmManager": false, "speedJumpFilter": 100, "startOnBoot": false, "stationaryRadius": 25, "stopAfterElapsedMinutes": 300, "stopOnStationary": false, "stopOnTerminate": false, "stopTimeout": 10, "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking", "url": "", "useSignificantChangesOnly": false, "enabled": true, "schedulerEnabled": false, "trackingMode": 1, "odometer": 13558.8251953125, "isFirstBoot": false, "didLaunchInBackground": false, "didDeviceReboot": false } 10-19 11:50:59.110 INFO [LoggerFacade$a a] ╔═════════════════════════════════════════════ ║ DEVICE SENSORS ╠═════════════════════════════════════════════ ╟─ ✅ ACCELEROMETER: {Sensor name="ACCELEROMETER", vendor="icm40607_acc", version=1, type=1, maxRange=78.453606, resolution=0.0012, power=0.001, minDelay=5000} ╟─ ✅ GYROSCOPE: {Sensor name="GYROSCOPE", vendor="icm40607_gyro", version=1, type=4, maxRange=34.9063, resolution=0.0011, power=0.001, minDelay=5000} ╟─ ✅ MAGNETOMETER: {Sensor name="MAGNETOMETER", vendor="MTK", 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} ╚═════════════════════════════════════════════ 10-19 11:50:59.112 DEBUG [LoggerFacade$a a] ℹ️ Load last odometer location: Location[TSLocationManager 45.821949,4.706833 hAcc=3.925 et=0 {Bundle[{odometer=13558.825}]}] 10-19 11:50:59.147 DEBUG [HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 10-19 11:50:59.194 INFO [TSProviderManager startMonitoring] 🎾 Start monitoring location-provider changes 10-19 11:50:59.195 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════

10-19 11:50:59.210 INFO [TSLocationManager requestLocationUpdates] 🎾 Location-services: ON 10-19 11:50:59.241 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1 10-19 11:50:59.256 INFO [TSGeofenceManager start] 🎾 Start monitoring geofences 10-19 11:50:59.288 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 10-19 11:50:59.303 DEBUG [SQLiteLocationDAO prune] ℹ️ PRUNE -1 days 10-19 11:50:59.307 INFO [HeartbeatService start] 🎾 Start heartbeat (300s) 10-19 11:50:59.315 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 11:50:59.332 INFO [TSLocationManager d] 🔴 Location-services: OFF 10-19 11:50:59.338 INFO [TrackingService changePace] 🔵 setPace: true → false 10-19 11:50:59.381 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 1 (249077ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.821949,4.706833 hAcc=3.925 et=+12d16h20m9s781ms alt=362.20001220703125 vAcc=12.408764 vel=0.9651481 sAcc=0.5 bear=84.99252 bAcc=15.8 {Bundle[{battery_level=0.9, is_charging=false, odometer=13558.825}]}], time: 1729331210302

10-19 11:50:59.448 DEBUG [TSLocationManager a] Median accuracy: 3.925 10-19 11:50:59.515 DEBUG [LocationAuthorization withPermission] ℹ️ LocationAuthorization: Permission granted 10-19 11:50:59.591 DEBUG [AbstractService a] 🎾 start [LocationRequestService startId: 1, eventCount: 1] 10-19 11:50:59.598 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 1, requestId: 1] 10-19 11:50:59.604 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 10-19 11:51:01.658 DEBUG [AbstractService a] 🎾 1:1 [LocationRequestService startId: 2, eventCount: 1] 10-19 11:51:01.666 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 1 (190ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.822313,4.708938 hAcc=3.7 et=+12d16h24m20s953ms alt=362.20001220703125 vAcc=14.920484 vel=0.69281614 sAcc=2.9 bear=19.0 bAcc=137.0], time: 1729331461474

10-19 11:51:01.672 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 10-19 11:51:01.675 DEBUG [TSLocationManager a] Median accuracy: 3.8125 10-19 11:51:01.693 DEBUG [AbstractService b] 🎾 STOP [LocationRequestService startId: 3, eventCount: 2] 10-19 11:51:01.694 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 3, eventCount: 1, sticky: false] 10-19 11:51:01.741 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 2, eventCount: 0, sticky: false] 10-19 11:51:01.743 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 45.8223133,4.7089383 hAcc=3.7) 10-19 11:51:01.774 DEBUG [AbstractService a] 🎾 motionchange [TrackingService startId: 1, eventCount: 1] 10-19 11:51:01.778 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════

10-19 11:51:01.786 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: false] 10-19 11:51:01.951 DEBUG [AbstractService f] ⚙️︎ LocationRequestService.stopSelfResult(3): true 10-19 11:51:01.953 DEBUG [AbstractService onDestroy] 🔴 LocationRequestService stopped 10-19 11:51:01.997 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(1): true 10-19 11:51:01.999 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 10-19 11:56:40.575 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 11:56:40.579 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 11:56:40.586 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 12:01:41.262 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 12:01:41.266 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 12:01:41.272 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 12:02:01.650 DEBUG [LifecycleManager onStart] ☯️ onStart 10-19 12:02:01.656 DEBUG [LifecycleManager onResume] ☯️ onResume 10-19 12:02:04.098 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, debug, desiredAccuracy, disableElasticity, extras, fastestLocationUpdateInterval, headers, headlessJobService, heartbeatInterval, logLevel, maxRecordsToPersist, notification, notification.title, notification.text, params, schedule, speedJumpFilter, stopAfterElapsedMinutes, stopOnTerminate, stopTimeout] 10-19 12:02:04.118 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, debug, desiredAccuracy, disableElasticity, fastestLocationUpdateInterval, headlessJobService, heartbeatInterval, isMoving, logLevel, maxRecordsToPersist, notification, notification.title, notification.text, speedJumpFilter, stopAfterElapsedMinutes, stopOnTerminate, stopTimeout] 10-19 12:02:04.129 DEBUG [LocationAuthorization withBackgroundPermission] ℹ️ LocationAuthorization: Permission granted 10-19 12:02:04.134 DEBUG [HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 10-19 12:02:04.137 DEBUG [DeviceSettings startMonitoringPowerSaveChanges] 🎾 Start monitoring powersave changes 10-19 12:02:04.138 DEBUG [TSGeofenceManager$e run]

mbuttin avatar Oct 20 '24 08:10 mbuttin

My second case is : at 13:01, I stay stationnary long enough to fire the stop_timeout. I start to move physically around 13:05, but I have no detection of movements up to 13:36. So I should do something wrong when the plugin goes to "still" mode and only got heartbeat... Could you help me understand what's going on and what I should change ?

╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: STOP_TIMEOUT ╠═════════════════════════════════════════════

10-19 13:01:40.586 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 10-19 13:01:40.600 INFO [HeartbeatService start] 🎾 Start heartbeat (300s) 10-19 13:01:40.605 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:01:40.618 INFO [TSLocationManager d] 🔴 Location-services: OFF 10-19 13:01:40.625 INFO [TrackingService changePace] 🔵 setPace: true → false 10-19 13:01:40.661 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 4 (358ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.824047,4.713852 hAcc=1.6 et=+12d17h34m59s780ms alt=359.3 vAcc=4.7 vel=0.0 sAcc=0.9], time: 1729335700301

10-19 13:01:40.664 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 10-19 13:01:40.666 DEBUG [TSLocationManager a] Median accuracy: 1.8 10-19 13:01:40.667 DEBUG [TSLocationManager c] Odometer: 15240.054 10-19 13:01:40.742 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 45.8240467,4.7138517 hAcc=1.6) 10-19 13:01:40.760 DEBUG [AbstractService a] 🎾 motionchange [TrackingService startId: 152, eventCount: 1] 10-19 13:01:40.760 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════

10-19 13:01:40.767 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 152, eventCount: 0, sticky: false] 10-19 13:01:40.975 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(152): true 10-19 13:01:40.979 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 10-19 13:06:40.614 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:06:40.618 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:06:40.625 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:11:41.269 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:11:41.273 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:11:41.279 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:16:42.267 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:16:42.271 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:16:42.280 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:21:40.548 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:21:40.553 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:21:40.559 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:26:42.272 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:26:42.276 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:26:42.282 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:31:41.272 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:31:41.278 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:31:41.285 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:36:42.265 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-19 13:36:42.270 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-19 13:36:42.279 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-19 13:36:51.359 DEBUG [AbstractService a] 🎾 STATIONARY_GEOFENCE [GeofencingService startId: 1, eventCount: 1] 10-19 13:36:51.365 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 10-19 13:36:51.370 INFO [HeartbeatService stop] 🔴 Stop heartbeat 10-19 13:36:51.372 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: HEARTBEAT 10-19 13:36:51.376 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 10-19 13:36:51.381 INFO [TrackingService changePace] 🔵 setPace: false → true 10-19 13:36:51.401 DEBUG [AbstractService a] 🎾 motionchange [TrackingService startId: 1, eventCount: 1] 10-19 13:36:51.402 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════

10-19 13:36:51.404 INFO [TSScheduleManager oneShot] ⏰ Oneshot STOP_AFTER_ELAPSED_MINUTES is already pending 10-19 13:36:51.405 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: true] 10-19 13:36:51.414 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 5 (238201ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.827273,4.712661 hAcc=64.1 et=+12d18h6m12s690ms alt=335.20001220703125 vAcc=37.696053], time: 1729337573211

10-19 13:36:51.416 DEBUG [TSLocationManager a] Median accuracy: 1.8 10-19 13:36:51.424 DEBUG [LocationAuthorization withPermission] ℹ️ LocationAuthorization: Permission granted 10-19 13:36:51.440 INFO [GeofencingService b] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.827273,4.712661 hAcc=64.1 et=+12d18h6m12s690ms alt=335.20001220703125 vAcc=37.696053]

10-19 13:36:51.442 DEBUG [AbstractService a] ⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false] 10-19 13:36:51.470 DEBUG [AbstractService a] 🎾 start [LocationRequestService startId: 1, eventCount: 1] 10-19 13:36:51.472 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 1, requestId: 5] 10-19 13:36:51.476 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 10-19 13:36:51.648 DEBUG [AbstractService f] ⚙️︎ GeofencingService.stopSelfResult(1): true 10-19 13:36:51.649 DEBUG [AbstractService onDestroy] 🔴 GeofencingService stopped

mbuttin avatar Oct 20 '24 08:10 mbuttin

And last subject for this field test : from 14:30 to 14:34, the gps location recorded did jumps far away from the location where the phone was, despite the "prevent jump" in the ready function. Is there any reason it did that ? Question : is it possible to have the same "prevent jump" for ios ? During my field test with an iphone, the gps location jumped a lot more than the android ones...

Here are the logs : 10-19 14:30:04.191 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 502, eventCount: 1] 10-19 14:30:04.194 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.825730,4.715996 hAcc=899.999 et=+2d23h42m22s768ms alt=338.0 vAcc=9.0] ╟─ Age: 106ms, time: 1729341004086

10-19 14:30:04.196 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:30:04.198 DEBUG [TSLocationManager a] Median accuracy: 1.5 10-19 14:30:04.200 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 214120ms (jobID: -18513055) 10-19 14:30:04.204 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 502, eventCount: 0, sticky: true] 10-19 14:30:12.712 DEBUG [AbstractService a] 🎾 start [ActivityRecognitionService startId: 1, eventCount: 1] 10-19 14:30:12.715 DEBUG [ActivityRecognitionService a] *** wasMoving: true, nowMoving: false, startedMoving: false, justStopped; true 10-19 14:30:12.722 INFO [ActivityRecognitionService a] ╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🔴 EXIT: on_bicycle ╟─ 🎾 ENTER: still ╚═════════════════════════════════════════════ 10-19 14:30:12.723 DEBUG [AbstractService a] ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] 10-19 14:30:12.728 DEBUG [AbstractService a] 🎾 STOP_TIMEOUT [TrackingService startId: 503, eventCount: 1] 10-19 14:30:12.789 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: STOP_TIMEOUT in 600000ms (jobID: 2059034116) 10-19 14:30:12.792 WARN [TSScheduleManager oneShot] ℹ️ Scheduling exact alarms requires android.permission.USE_EXACT_ALARM with SDK >= 34. Oneshot using in-exact Alarm 10-19 14:30:12.800 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: MOTION_ACTIVITY_CHECK 10-19 14:30:12.805 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 503, eventCount: 0, sticky: true] 10-19 14:30:12.940 DEBUG [AbstractService f] ⚙️︎ ActivityRecognitionService.stopSelfResult(1): true 10-19 14:30:12.943 DEBUG [AbstractService onDestroy] 🔴 ActivityRecognitionService stopped 10-19 14:30:34.415 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 504, eventCount: 1] 10-19 14:30:34.419 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.820265,4.704374 hAcc=899.999 et=+2d23h42m52s948ms alt=338.0 vAcc=9.0] ╟─ Age: 151ms, time: 1729341034267

10-19 14:30:34.420 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:30:34.420 INFO [TrackingService b] ℹ️ Distance from stoppedAtLocation: -150.87805 10-19 14:30:34.421 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 504, eventCount: 0, sticky: true] 10-19 14:30:34.421 DEBUG [TSLocationManager d] Distance from last location: 1088.4325, apparent speed: 36.064697 10-19 14:30:34.422 DEBUG [TSLocationManager a] Median accuracy: 1.5 10-19 14:30:39.411 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 505, eventCount: 1] 10-19 14:30:39.414 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.826436,4.708415 hAcc=1140.976 et=+2d23h42m57s977ms alt=338.0 vAcc=9.0] ╟─ Age: 118ms, time: 1729341039296

10-19 14:30:39.415 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:30:39.415 INFO [TrackingService b] ℹ️ Distance from stoppedAtLocation: -1146.213 10-19 14:30:39.416 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 505, eventCount: 0, sticky: true] 10-19 14:30:39.416 DEBUG [TSLocationManager a] Median accuracy: 1.5 10-19 14:30:59.577 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 506, eventCount: 1] 10-19 14:30:59.578 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.820265,4.704374 hAcc=899.999 et=+2d23h43m18s123ms alt=338.0 vAcc=9.0] ╟─ Age: 136ms, time: 1729341059442

10-19 14:30:59.579 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:30:59.579 INFO [TrackingService b] ℹ️ Distance from stoppedAtLocation: -150.87805 10-19 14:30:59.580 DEBUG [TSLocationManager a] Median accuracy: 5.237 10-19 14:30:59.580 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 506, eventCount: 0, sticky: true] 10-19 14:31:09.638 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 507, eventCount: 1] 10-19 14:31:09.640 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.826436,4.708415 hAcc=1322.176 et=+2d23h43m28s177ms alt=338.0 vAcc=9.0] ╟─ Age: 144ms, time: 1729341069496

10-19 14:31:09.641 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:31:09.641 INFO [TrackingService b] ℹ️ Distance from stoppedAtLocation: -1327.4131 10-19 14:31:09.641 DEBUG [TSLocationManager a] Median accuracy: 5.237 10-19 14:31:09.642 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 507, eventCount: 0, sticky: true] 10-19 14:31:13.091 DEBUG [AbstractService a] 🎾 start [ActivityRecognitionService startId: 1, eventCount: 1] 10-19 14:31:13.094 DEBUG [ActivityRecognitionService a] *** wasMoving: true, nowMoving: true, startedMoving: false, justStopped; false 10-19 14:31:13.096 INFO [ActivityRecognitionService a] ╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🔴 EXIT: still ╟─ 🎾 ENTER: on_bicycle ╚═════════════════════════════════════════════ 10-19 14:31:13.097 DEBUG [AbstractService a] ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] 10-19 14:31:13.098 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: STOP_TIMEOUT 10-19 14:31:13.362 DEBUG [AbstractService f] ⚙️︎ ActivityRecognitionService.stopSelfResult(1): true 10-19 14:31:13.367 DEBUG [AbstractService onDestroy] 🔴 ActivityRecognitionService stopped 10-19 14:31:34.794 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 508, eventCount: 1] 10-19 14:31:34.797 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.825730,4.715996 hAcc=899.999 et=+2d23h43m53s353ms alt=338.0 vAcc=9.0] ╟─ Age: 125ms, time: 1729341094671

10-19 14:31:34.798 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-19 14:31:34.799 DEBUG [TSLocationManager a] Median accuracy: 899.999 10-19 14:31:34.806 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 85176ms (jobID: -18513055) 10-19 14:31:34.815 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 508, eventCount: 0, sticky: true] 10-19 14:32:18.610 DEBUG [AbstractService a] 🎾 start [ActivityRecognitionService startId: 1, eventCount: 1] 10-19 14:32:18.612 DEBUG [ActivityRecognitionService a] *** wasMoving: true, nowMoving: false, startedMoving: false, justStopped; true

mbuttin avatar Oct 20 '24 10:10 mbuttin

hAcc=899.999

These “jumps” are due to poor accuracy locations being returned by your device.

TrackingService stopped log (did nothing for that)

This is perfectly normal. That service stays active only when the device is in the “moving” state. That service is supposed to stop when the plug-in in the stationary state.

read the wiki “Philosophy of Operation”.

christocracy avatar Oct 20 '24 15:10 christocracy

hAcc=899.999

These “jumps” are due to poor accuracy locations being returned by your device.

That's what I was thinking. What's strange is that it appears only for this small amount of time, it works fine rest of the time. From your experience, is that normal to encounter brief periods of bad gps positionning ? (samsung phone on android).

I've seen that the plugin is able to take several gps location in order to have a more accurate prositionning (probably removing those "jumps"?). My app suscribed to onLocation events. Is it possible for the plugin to use several gps location to calculate a good position, but fire only once onLocation ? Or will it be fired on each of those several gps points ? I don't need the positionning to be fast, severall seconds are ok.

Thanks for support on sunday :)

mbuttin avatar Oct 20 '24 16:10 mbuttin

Hi @christocracy , Could you please help me understand this log and what could have occured ? On an android phone.

I was continuously walking my trail with phone in the bag, and it looks like something occured at 13:26, and the plugin only "heartbeated" until 15:08. Then it started again to act normally up to the end of the trail.

From what I understand, "ismoving" became false at 13:26 (it's possible that I stopped for few minutes there). 10-25 13:26:40.610 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false

Then, it start monitoring a stationary region with a radius of 150m. Why 150m ? Where does it come from ? Of course, I mooved a lot more than 150m before 15:08 when it start to act normally again. 10-25 13:26:40.720 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 45.9706483,5.0109717 hAcc=1.35)

And then at 15:08, setPace became true and location start again to be managed normally. What could have caused this new change of state ? 10-25 15:08:48.473 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 10-25 15:08:48.484 INFO [TrackingService changePace] 🔵 setPace: false → true

Thanks if you can explain me physically what occured and how to avoid that when my app is running ? Here is the full log.

╔═════════════════════════════════════════════ ║ motionchange LocationResult: 3 (293ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.970648,5.010972 hAcc=1.35 et=+18d17h59m59s789ms alt=338.4 vAcc=6.0 vel=0.0 sAcc=0.7], time: 1729855600311

10-25 13:26:40.610 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 10-25 13:26:40.611 DEBUG [TSLocationManager a] Median accuracy: 1.683 10-25 13:26:40.613 DEBUG [TSLocationManager c] Odometer: 7795.858 10-25 13:26:40.720 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 45.9706483,5.0109717 hAcc=1.35) 10-25 13:26:40.754 DEBUG [AbstractService a] 🎾 motionchange [TrackingService startId: 107, eventCount: 1] 10-25 13:26:40.755 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════

10-25 13:26:40.766 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 107, eventCount: 0, sticky: false] 10-25 13:26:40.979 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(107): true 10-25 13:26:40.983 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 10-25 13:31:41.273 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:31:41.277 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:31:41.290 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 13:36:41.277 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:36:41.284 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:36:41.290 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 13:41:41.259 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:41:41.264 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:41:41.271 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 13:46:41.240 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:46:41.246 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:46:41.253 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 13:51:40.551 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:51:40.555 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:51:40.562 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 13:56:41.293 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 13:56:41.299 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 13:56:41.306 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:01:42.297 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:01:42.303 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:01:42.321 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:06:40.550 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:06:40.554 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:06:40.562 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:11:40.551 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:11:40.555 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:11:40.561 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:16:41.257 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:16:41.260 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:16:41.269 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:21:40.550 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:21:40.554 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:21:40.562 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:26:41.263 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:26:41.268 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:26:41.277 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:31:41.259 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:31:41.271 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:31:41.278 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:36:40.625 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:36:40.629 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:36:40.636 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:41:41.266 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:41:41.271 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:41:41.277 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:46:40.549 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:46:40.555 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:46:40.560 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:51:40.544 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:51:40.549 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:51:40.556 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 14:56:41.244 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 14:56:41.247 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 14:56:41.258 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 15:01:41.257 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 15:01:41.264 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 15:01:41.270 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 15:06:41.281 INFO [ScheduleEvent a] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: HEARTBEAT ╠═════════════════════════════════════════════

10-25 15:06:41.286 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748) 10-25 15:06:41.292 DEBUG [HeartbeatService onHeartbeat] ❤️ 10-25 15:08:48.450 DEBUG [AbstractService a] 🎾 STATIONARY_GEOFENCE [GeofencingService startId: 1, eventCount: 1] 10-25 15:08:48.458 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 10-25 15:08:48.460 INFO [HeartbeatService stop] 🔴 Stop heartbeat 10-25 15:08:48.467 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: HEARTBEAT 10-25 15:08:48.473 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 10-25 15:08:48.484 INFO [TrackingService changePace] 🔵 setPace: false → true 10-25 15:08:48.508 DEBUG [AbstractService a] 🎾 motionchange [TrackingService startId: 1, eventCount: 1] 10-25 15:08:48.509 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════

10-25 15:08:48.513 INFO [TSScheduleManager oneShot] ⏰ Oneshot STOP_AFTER_ELAPSED_MINUTES is already pending 10-25 15:08:48.514 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: true] 10-25 15:08:48.528 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 4 (275ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.974087,5.014094 hAcc=36.9 et=+18d19h42m7s731ms alt=334.70001220703125 vAcc=5.501157], time: 1729861728253

10-25 15:08:48.532 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: true 10-25 15:08:48.534 DEBUG [TSLocationManager a] Median accuracy: 1.7 10-25 15:08:48.535 DEBUG [TSLocationManager c] Odometer: 8248.244 10-25 15:08:48.545 INFO [TSLocationManager requestLocationUpdates] 🎾 Location-services: ON 10-25 15:08:48.546 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1 10-25 15:08:48.549 INFO [GeofencingService b] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.974087,5.014094 hAcc=36.9 et=+18d19h42m7s731ms alt=334.70001220703125 vAcc=5.501157]

10-25 15:08:48.550 DEBUG [AbstractService a] ⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false] 10-25 15:08:48.559 INFO [ActivityRecognitionService start] 🎾 Start motion-activity updates 10-25 15:08:48.595 DEBUG [AbstractService a] 🎾 start [TrackingService startId: 2, eventCount: 1] 10-25 15:08:48.599 DEBUG [TrackingService c] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 45.974087,5.014094 hAcc=36.9 et=+18d19h42m7s731ms alt=334.70001220703125 vAcc=5.501157] ╟─ Age: 346ms, time: 1729861728253

mbuttin avatar Oct 25 '24 19:10 mbuttin

See wiki “Philosophy of Operation” and api docs Config.stopTimeout.

christocracy avatar Oct 25 '24 19:10 christocracy

See wiki “Philosophy of Operation” and api docs Config.stopTimeout.

Yeah, I copy that. The timeout occurs and the device goes in stationnary mode. I'm fine with that. But I don't understand why it goes in moving state only 1h30 later and several km later... ? It looks to me that this part of the philosophy of operation didn't work as expected for me. "When any motion-type activity is detected (eg: on_foot), the plugin will enter the moving state, turn location-services on and begin recording a location each distanceFilter meters. As a backup motion-detection mechanism, the plugin also monitors a geofence of radius 200 meters around the last known position — when the device exits this 200 meter geofence, the device will enter the moving state." So, as the plugin stay in heartbeat mode for 1h30, it's because no motion-type activity has been detected (but I was actively moving) and the backup geofence (I suppose that's where the value 150m come from, instead of 200m) break isn't detected (but I was several km far). I'm probably doing something wrong, but from your point of view, what could cause those 2 failures ?

mbuttin avatar Oct 25 '24 21:10 mbuttin

but I was actively moving

There is no guarantee. It completely depends upon the quality of the Android device.

iOS tends to be much more consistent.

for Android, see https://dontkillmyapp.com

christocracy avatar Oct 25 '24 21:10 christocracy

Ok, so everything 's fine and it's just a "it could happen" case ?

What could I do to avoid this ? If I request location from the plugin at a heartbeat rate, will it help it to go again in active mode, as it will "see" that I moved ?

mbuttin avatar Oct 26 '24 06:10 mbuttin

stopAfterElapsedMinutes: 300,

Do you know what that option does?

christocracy avatar Oct 28 '24 20:10 christocracy

From what I understand, it .stop() the plugin after the set time after .start() the plugin ? I use this so that if user forgot to stop the tracking, it will stop by itself after 5 hours.

mbuttin avatar Oct 28 '24 20:10 mbuttin

That's right. And it sounds similar to the problem you're having.

christocracy avatar Oct 28 '24 20:10 christocracy

Yeah, but it occurs around 2hrs after .start(), so probably unrelated. I improved my websocket connexion and it didn't happen again in my latest tests. Time will tell if it was just a "sometime things goes wrong" or if I have to make this better.

mbuttin avatar Oct 28 '24 21:10 mbuttin

Hi, If you don't mind, I will ask this here instead of create a new thread, as it's a detail (?). When onLocation fire, I access location.coords.latitude/longitude. And one time, location.coords was undefined. As I didn't expect onLocation event without having location.coords, I didn't test it before using it. I will definitely add it. But for my information and eventually improve things, could you tell me what occured there ?

╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════

10-29 13:29:21.155 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 422, eventCount: 0, sticky: true] 10-29 13:29:21.155 DEBUG [TSLocationManager d] Distance from last location: 10.662956, apparent speed: 1.5232794 10-29 13:29:21.157 DEBUG [TSLocationManager a] Median accuracy: 1.5 10-29 13:29:21.158 DEBUG [TSLocationManager c] Odometer: 10600.159 10-29 13:29:25.495 WARN [SingleLocationRequest finish] ⚠️ 📍 SingleLocationRequest TIMEOUT: 3 10-29 13:29:25.498 WARN [TSLocationManager onLocationError] ⚠️ TSLocationManager received location error: 408 10-29 13:29:25.502 WARN [BackgroundGeolocation _onLocationError] ⚠️ Location error: 408 10-29 13:29:25.683 INFO [TSLocationManager d] 🔴 Location-services: OFF 10-29 13:29:25.695 ERROR [BackgroundGeolocation$w0 uncaughtException] ‼️ Uncaught Exception: TypeError: Cannot read property 'latitude' of undefined, js engine: hermes, stack:

mbuttin avatar Oct 29 '24 16:10 mbuttin

See the api docs event .onLocation. It takes a 2nd Arg, error callback. You are providing only the 1st arg, so location errors are sent to the 1st function, which doesn’t have the same object signature as a location,

christocracy avatar Oct 29 '24 16:10 christocracy

Thanks, will fix that. Concerning logs journal : I really like your logs. Is there any way to insert some lines to put my code logs in the same file and export ? Could be really cool.

mbuttin avatar Oct 30 '24 16:10 mbuttin

s. Is there any way to insert some lines to put my code logs in the same file and export

Yes. Search the api docs “Logger”

https://transistorsoft.github.io/react-native-background-geolocation/interfaces/logger.html

christocracy avatar Oct 30 '24 17:10 christocracy

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

github-actions[bot] avatar Nov 30 '24 02:11 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Dec 14 '24 02:12 github-actions[bot]