Heartbeat will send last known location. That's expected.
Well in that case it isn't working as it isn't sending anything.
Here is what is going on.
Distance 100000 meters
heartbeat 5 seconds
Which means it should send the last known location once every 5 seconds, server gets no requests once every 5 seconds. (Distance is set to a high value to prevent location updates from being sent to see what does the heartbeat does and capture the request on the server)
That's not how it works. Heartbeat is only sent in stationary state.
Also if you're using iOS, you have to enable "prevent suspend" option for it to work reliably.
Yup it is stationary, when I manually send location server gets activity : still . And still no http requests sent for heartbeat . I am on Android btw
Actually you can't have heartbeat 5 seconds. Minimum is 60 seconds.
Ok I can change the value and test. Would really appreciate also an explanation to what does disable elasticity and stop detection options do but maybe on the other thread for that question for anyone who is also wondering what they do to see your answer
You can read about it here:
And since there are minimum values for some fields, we would really appreciate a clear heads up in the app about it ( I suspect there must also be limits to the distance, maybe ?)
Not that I'm aware of, but there are some gotchas about distance, specifically for iOS:
https://github.com/transistorsoft/flutter_background_geolocation/wiki/Philosophy-of-Operation
Hi, Anton
Regarding heartbeat, I observed that the heartbeat event was triggered but no HTTP post was fired. Here is the log:
06-14 01:59:01.488 INFO [TSGeofenceManager start]
?? Start monitoring geofences
06-14 01:59:01.502 INFO [ActivityRecognitionService start]
?? Start motion-activity updates
06-14 01:59:01.512 INFO [HeartbeatService start]
?? Start heartbeat (300s)
06-14 01:59:01.516 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 01:59:01.528 INFO [TrackingService changePace]
?? setPace: false ? false
06-14 01:59:01.542 INFO [TSLocationManager a]
+---------------------------------------------
¦ motionchange LocationResult: 4 (216351ms old)
¦---------------------------------------------
¦- ?? Location[fused -6.xxxxxx,106.xxxxxx acc=18 et=+5d22h2m5s665ms alt=24.900001525878906 {Bundle[{}]}], time: 1749840925191
06-14 01:59:01.577 INFO [SingleLocationRequest startUpdatingLocation]
?? [SingleLocationRequest start, action: 1, requestId: 4]
06-14 01:59:02.224 INFO [TSLocationManager a]
+---------------------------------------------
¦ motionchange LocationResult: 4 (132ms old)
¦---------------------------------------------
¦- ?? Location[fused -6.xxxxxx,106.xxxxxx acc=17 et=+5d22h5m42s566ms alt=24.900001525878906 {Bundle[{noGPSLocation=Location[fused -6.xxxxxx,106.xxxxxx acc=17 et=+5d22h5m42s566ms alt=24.900001525878906 {Bundle[mParcelledData.dataSize=508]}], requestId=4, verticalAccuracy=21.270393}]}], time: 1749841142091
06-14 01:59:02.228 INFO [TSLocationManager onSingleLocationResult]
?? Acquired motionchange position, isMoving: false
06-14 01:59:02.239 INFO [SQLiteLocationDAO persist]
? INSERT: c5edf847-2459-415a-bfef-5e6723665008
06-14 01:59:02.269 INFO [TrackingService k]
+---------------------------------------------
¦ TrackingService motionchange: false
¦---------------------------------------------
06-14 01:59:02.283 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 1)
¦---------------------------------------------
06-14 01:59:02.400 INFO [BackgroundTaskManager$Task start] ? startBackgroundTask: 3
06-14 01:59:02.406 INFO [HttpService a]
?? HTTP POST: c5edf847-2459-415a-bfef-5e6723665008
06-14 01:59:02.532 INFO [HttpService flush]
?? HttpService is busy
06-14 01:59:03.065 INFO [HttpService$f onResponse]
?? Response: 200
06-14 01:59:03.074 INFO [BackgroundTaskManager$Task stop] ? stopBackgroundTask: 3
06-14 02:04:01.530 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: HEARTBEAT
¦---------------------------------------------
06-14 02:04:01.538 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:05:10.926 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:05:13.059 INFO [TSScheduleManager oneShot]
? Oneshot TERMINATE_EVENT is already pending
06-14 02:05:20.959 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: TERMINATE_EVENT
¦---------------------------------------------
06-14 02:05:50.808 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:05:51.702 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:06:01.721 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: TERMINATE_EVENT
¦---------------------------------------------
06-14 02:09:01.574 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: HEARTBEAT
¦---------------------------------------------
06-14 02:09:01.579 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:09:30.851 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:12:38.047 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:12:48.060 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: TERMINATE_EVENT
¦---------------------------------------------
06-14 02:13:12.877 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:13:18.421 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:13:26.531 INFO [TSScheduleManager cancelOneShot]
? Cancel OneShot: TERMINATE_EVENT
06-14 02:13:26.560 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:14:01.596 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: HEARTBEAT
¦---------------------------------------------
06-14 02:14:01.604 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:16:10.595 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:16:13.507 INFO [TSScheduleManager cancelOneShot]
? Cancel OneShot: TERMINATE_EVENT
06-14 02:16:13.526 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:17:27.054 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-14 02:17:37.072 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: TERMINATE_EVENT
¦---------------------------------------------
06-14 02:18:03.807 INFO [BackgroundGeolocation e]
+---------------------------------------------
¦ MainActivity was destroyed
¦---------------------------------------------
¦- stopOnTerminate: false
¦- enabled: true
06-14 02:19:01.638 INFO [ScheduleEvent a]
+---------------------------------------------
¦ ? OneShot event fired: HEARTBEAT
¦---------------------------------------------
06-14 02:19:01.647 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:19:07.944 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:19:08.208 INFO [HeartbeatService start]
?? Start heartbeat (300s)
06-14 02:19:08.211 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:19:08.229 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:19:08.265 INFO [ActivityRecognitionService start]
?? Start motion-activity updates
06-14 02:19:08.271 INFO [HeartbeatService start]
?? Start heartbeat (300s)
06-14 02:19:08.273 INFO [TSScheduleManager cancelOneShot]
? Cancel OneShot: HEARTBEAT
06-14 02:19:08.280 INFO [TSScheduleManager oneShot]
? Scheduled OneShot: HEARTBEAT in 300000ms (jobID: -1307475748)
06-14 02:19:08.445 INFO [TSLocationManager a]
+---------------------------------------------
¦ motionchange LocationResult: 5 (1206353ms old)
¦---------------------------------------------
¦- ?? Location[fused -6.xxxxxx,106.xxxxxx acc=17 et=+5d22h5m42s566ms alt=24.900001525878906 {Bundle[{}]}], time: 1749841142091
06-14 02:19:08.630 INFO [SingleLocationRequest startUpdatingLocation]
?? [SingleLocationRequest start, action: 1, requestId: 5]
06-14 02:19:10.563 INFO [HttpService flush]
+---------------------------------------------
¦ HTTP Service (count: 0)
¦---------------------------------------------
06-14 02:19:10.717 INFO [TSLocationManager a]
+---------------------------------------------
¦ motionchange LocationResult: 5 (735ms old)
¦---------------------------------------------
¦- ?? Location[fused -6.xxxxxx,106.xxxxxx acc=17 et=+5d22h25m50s456ms alt=24.900001525878906 {Bundle[{noGPSLocation=Location[fused -6.xxxxxx,106.xxxxxx acc=17 et=+5d22h25m50s456ms alt=24.900001525878906 {Bundle[mParcelledData.dataSize=628]}], requestId=5, verticalAccuracy=21.961502}]}], time: 1749842349981
06-14 02:19:10.720 INFO [TSLocationManager onSingleLocationResult]
?? Acquired motionchange position, isMoving: false
06-14 02:19:10.781 INFO [TrackingService k]
+---------------------------------------------
¦ TrackingService motionchange: false
¦---------------------------------------------
Heartbeat was set per 300 secs, the device was in complete stationary with accuracy set to high and disable elasticity on. CMIIW, heartbeat should send last stationary to server right? But here there was no HTTP sending event fired. Is this normal? I'm using apps v9.1.0 Android on Samsung.
Note that I masqueraded the latlon coords.
Same for me . Heartbeat fires when I set it to 61 seconds for testing but no http request gets sent. However since the app doesn't really work to update the location reliably anymore I didn't really post the update about my finding about heartbeat
I can confirm heartbeat is now sending HTTP post. Will do field testing now, let's see for the result in next few hours.
I can also confirm that heartbeat is also working now for me after 9.2 update
As per reading the posts on the forum, I think the heartbeat option is supposed to be sending a http request to the provided server url indicating this device is online once every x seconds but on the server there are no requests being sent whatsoever (except the location updates ones of course).
Am I missing something? Is this what the heartbeat is supposed to do?