transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
643 stars 239 forks source link

Heartbeat/Http Event does not include extras parameter #866

Closed yashhema closed 4 months ago

yashhema commented 1 year ago

Your Environment

Expected Behavior

Heartbeat/http event does not carry parameter provided in he httpcallableformat

Actual Behavior

Extraparameters are not taken as part of http payload

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

Logs ``` PASTE_YOUR_LOGS_HERE ``` I/TSLocationManager(13763): πŸ”΅ HTTP POST: 4728c9bf-9f51-45f9-8580-1594e92f426c I/flutter (13763): {"data":{"adhocactionmodel":{"staffid":"qjFne92NcLb7rNB5XRSQlAMoTE72"},"qrytype":"GETINITIALDATAFORSTAFFADHOCTRIP"}} W/TSLocationManager(13763): [c.t.l.http.HttpService$h onFailure] W/TSLocationManager(13763): ⚠️ Response: 0, timeout I/flutter (13763): [onHttp] status: 0, success? false, responseText: timeout D/TSLocationManager(13763): [c.t.l.data.sqlite.b unlock] D/TSLocationManager(13763): βœ… UNLOCKED: 4728c9bf-9f51-45f9-8580-1594e92f426c I/TSLocationManager(13763): [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 1 D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish BackgroundTaskService [eventCount: 0, sticky: false] D/TSLocationManager(13763): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(13763): πŸ”΄ BackgroundTaskService stopped I/TSLocationManager(13763): [c.t.l.s.TSScheduleManager oneShot] I/TSLocationManager(13763): ⏰ Scheduled OneShot: http_flush in 900000ms (jobID: 1267146893) D/TSLocationManager(13763): [c.t.l.service.AbstractService start] D/TSLocationManager(13763): 🎾 HeartbeatService [eventCount: 1] D/TSLocationManager(13763): [c.t.l.s.HeartbeatService$a run] ❀️ I/TSLocationManager(13763): [c.t.l.http.HttpService flush] I/TSLocationManager(13763): ╔═════════════════════════════════════════════ I/TSLocationManager(13763): β•‘ HTTP Service (count: 2) I/TSLocationManager(13763): ╠═════════════════════════════════════════════ D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish HeartbeatService [eventCount: 0, sticky: false] D/TSLocationManager(13763): [c.t.l.service.AbstractService start] D/TSLocationManager(13763): 🎾 BackgroundTaskService [eventCount: 1] I/TSLocationManager(13763): [c.t.l.u.BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 2 I/flutter (13763): [motionchange] - [HeartbeatEvent location:[Location {odometer: 8395152.0, activity: {confidence: 100, type: still}, extras: {ttyp: PEOPLE, vtyp: BUS, rname: MO1pPCcSeGhtC8PaE1Y3, allowedspid: [], spid: 5710369616035840, userid: qjFne92NcLb7rNB5XRSQlAMoTE72}, event: heartbeat, battery: {level: 1.0, is_charging: false}, uuid: ab484f3e-d193-4730-8683-55f4806ed7cb, coords: {altitude: 0.0, heading: 0.0, latitude: 53.475561666666664, accuracy: 5.0, heading_accuracy: 30.0, altitude_accuracy: 0.5, speed_accuracy: 0.5, speed: 0.0, longitude: -2.3200616666666667, ellipsoidal_altitude: 0.0}, is_moving: false, timestamp: 2022-10-24T18:47:26.386Z}]].location!.toString() D/TSLocationManager(13763): [c.t.l.data.sqlite.b first] D/TSLocationManager(13763): βœ… Locked 1 records I/TSLocationManager(13763): [c.t.l.http.HttpService a] I/TSLocationManager(13763): πŸ”΅ HTTP POST: 4728c9bf-9f51-45f9-8580-1594e92f426c D/TSLocationManager(13763): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(13763): πŸ”΄ HeartbeatService stopped V/MediaPlayer(13763): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer(13763): cleanDrmObj: mDrmObj=null mDrmSessionId=null W/TSLocationManager(13763): [c.t.l.http.HttpService$h onFailure] W/TSLocationManager(13763): ⚠️ Response: 0, timeout I/flutter (13763): [onHttp] status: 0, success? false, responseText: timeout D/TSLocationManager(13763): [c.t.l.data.sqlite.b unlock] D/TSLocationManager(13763): βœ… UNLOCKED: 4728c9bf-9f51-45f9-8580-1594e92f426c I/TSLocationManager(13763): [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 2 D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish BackgroundTaskService [eventCount: 0, sticky: false] D/TSLocationManager(13763): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(13763): πŸ”΄ BackgroundTaskService stopped I/TSLocationManager(13763): [c.t.l.s.TSScheduleManager oneShot] I/TSLocationManager(13763): ⏰ Oneshot http_flush is already pending W/System (13763): Ignoring header X-Firebase-Locale because its value was null. D/FirebaseAuth(13763): Notifying id token listeners about user ( qjFne92NcLb7rNB5XRSQlAMoTE72 ). I/flutter (13763): {"data":{"dto":null,"driverlist":null,"drivercardlist":null,"id":null,"actionrecordlist":null,"qrycode":null,"errorid":0,"errormsg":null,"peopleinfo":null}} D/TSLocationManager(13763): [c.t.l.service.AbstractService start] D/TSLocationManager(13763): 🎾 HeartbeatService [eventCount: 1] D/TSLocationManager(13763): [c.t.l.s.HeartbeatService$a run] ❀️ I/TSLocationManager(13763): [c.t.l.http.HttpService flush] I/TSLocationManager(13763): ╔═════════════════════════════════════════════ I/TSLocationManager(13763): β•‘ HTTP Service (count: 2) I/TSLocationManager(13763): ╠═════════════════════════════════════════════ D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish HeartbeatService [eventCount: 0, sticky: false] D/TSLocationManager(13763): [c.t.l.service.AbstractService start] D/TSLocationManager(13763): 🎾 BackgroundTaskService [eventCount: 1] I/TSLocationManager(13763): [c.t.l.u.BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 3 I/flutter (13763): [motionchange] - [HeartbeatEvent location:[Location {odometer: 8395152.0, activity: {confidence: 100, type: still}, extras: {ttyp: PEOPLE, vtyp: BUS, rname: MO1pPCcSeGhtC8PaE1Y3, allowedspid: [], spid: 5710369616035840, userid: qjFne92NcLb7rNB5XRSQlAMoTE72}, event: heartbeat, battery: {level: 1.0, is_charging: false}, uuid: 6953a3f4-cb78-47fa-a8bf-33b0d93a58d2, coords: {altitude: 0.0, heading: 0.0, latitude: 53.475561666666664, accuracy: 5.0, heading_accuracy: 30.0, altitude_accuracy: 0.5, speed_accuracy: 0.5, speed: 0.0, longitude: -2.3200616666666667, ellipsoidal_altitude: 0.0}, is_moving: false, timestamp: 2022-10-24T18:47:26.386Z}]].location!.toString() D/TSLocationManager(13763): [c.t.l.data.sqlite.b first] D/TSLocationManager(13763): βœ… Locked 1 records I/TSLocationManager(13763): [c.t.l.http.HttpService a] I/TSLocationManager(13763): πŸ”΅ HTTP POST: 4728c9bf-9f51-45f9-8580-1594e92f426c I/TSLocationManager(13763): [c.t.l.http.HttpService$h onResponse] I/TSLocationManager(13763): πŸ”΅ Response: 200 I/flutter (13763): [onHttp] status: 200, success? true, responseText: {"data":"Undefined rname"} D/TSLocationManager(13763): [c.t.l.data.sqlite.b destroy] D/TSLocationManager(13763): βœ… DESTROY: 4728c9bf-9f51-45f9-8580-1594e92f426c D/TSLocationManager(13763): [c.t.l.data.sqlite.b first] D/TSLocationManager(13763): βœ… Locked 1 records I/TSLocationManager(13763): [c.t.l.http.HttpService a] I/TSLocationManager(13763): πŸ”΅ HTTP POST: 69f933ab-cda4-4c14-87d9-57c5001b9ea3 I/TSLocationManager(13763): [c.t.l.http.HttpService$h onResponse] I/TSLocationManager(13763): πŸ”΅ Response: 200 I/flutter (13763): [onHttp] status: 200, success? true, responseText: {"data":"Undefined rname"} D/TSLocationManager(13763): [c.t.l.data.sqlite.b destroy] D/TSLocationManager(13763): βœ… DESTROY: 69f933ab-cda4-4c14-87d9-57c5001b9ea3 I/TSLocationManager(13763): [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 3 D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish BackgroundTaskService [eventCount: 0, sticky: false] D/TSLocationManager(13763): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(13763): πŸ”΄ BackgroundTaskService stopped D/TSLocationManager(13763): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(13763): πŸ”΄ HeartbeatService stopped V/MediaPlayer(13763): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false V/MediaPlayer(13763): cleanDrmObj: mDrmObj=null mDrmSessionId=null D/TSLocationManager(13763): [c.t.l.service.AbstractService start] D/TSLocationManager(13763): 🎾 HeartbeatService [eventCount: 1] D/TSLocationManager(13763): [c.t.l.s.HeartbeatService$a run] ❀️ D/TSLocationManager(13763): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish HeartbeatService [eventCount: 0, sticky: false]
christocracy commented 1 year ago

Heartbeat/Http Event does not include extras parameter

What makes you think that?

yashhema commented 1 year ago

This is the message which we recv on server {"location":{"is_moving":false,"uuid":"d90edd55-5434-4679-963c-171ccc164207","timestamp":"2022-10-30T18:02:42.006Z","odometer":8395152,"coords":{"latitude":53.475561666666664,"longitude":-2.3200616666666667,"accuracy":5,"speed":0,"speed_accuracy":0.5,"heading":0,"heading_accuracy":30,"altitude":0,"ellipsoidal_altitude":0,"altitude_accuracy":0.5},"activity":{"type":"still","confidence":100},"battery":{"is_charging":false,"level":1},"extras":{}}}

And sometimes we also recv message with extras values filled. For us , we need the extras other wise we are unable to determine user

Also one of the things we have observed , we see lots of time out , If u see the configuration I posed , we increased the time out value to a big number , still time out is coming

We are right now forcing the server to send 200 anytime it recvs any message

W/TSLocationManager(17659): [c.t.l.http.HttpService$h onFailure] W/TSLocationManager(17659): ⚠️ Response: 0, timeout D/TSLocationManager(17659): [c.t.l.data.sqlite.b unlock] D/TSLocationManager(17659): βœ… UNLOCKED: 85ce1685-ce45-4014-85d5-8a85a4a28bb4 I/TSLocationManager(17659): [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 6 D/TSLocationManager(17659): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish BackgroundTaskService [eventCount: 0, sticky: false] D/TSLocationManager(17659): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(17659): πŸ”΄ BackgroundTaskService stopped I/TSLocationManager(17659): [c.t.l.s.TSScheduleManager oneShot] I/TSLocationManager(17659): ⏰ Oneshot http_flush is already pending D/TSLocationManager(17659): [c.t.l.service.AbstractService start] D/TSLocationManager(17659): 🎾 HeartbeatService [eventCount: 1] D/TSLocationManager(17659): [c.t.l.s.HeartbeatService$a run] ❀️ I/flutter (17659): {"data":{"dsrequest":{"plocinfo":{"lati":53.475561666666664,"longi":-2.3200616666666667,"reptime":1667549159,"spid":"5710369616035840","userid":"qjFne92NcLb7rNB5XRSQlAMoTE72","ttyp":"VEHICLE","vtyp":"BUS"},"rname":"MO1pPCcSeGhtC8PaE1Y3","id":"qjFne92NcLb7rNB5XRSQlAMoTE72"},"qrytype":"TPEOPLELOC"}} I/TSLocationManager(17659): [c.t.l.http.HttpService flush] I/TSLocationManager(17659): ╔═════════════════════════════════════════════ I/TSLocationManager(17659): β•‘ HTTP Service (count: 4) I/TSLocationManager(17659): ╠═════════════════════════════════════════════ D/TSLocationManager(17659): [c.t.l.service.AbstractService finish] βš™οΈοΈŽ finish HeartbeatService [eventCount: 0, sticky: false] D/TSLocationManager(17659): [c.t.l.service.AbstractService start] D/TSLocationManager(17659): 🎾 BackgroundTaskService [eventCount: 1] I/TSLocationManager(17659): [c.t.l.u.BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 7 D/TSLocationManager(17659): [c.t.l.data.sqlite.b first] D/TSLocationManager(17659): βœ… Locked 1 records I/TSLocationManager(17659): [c.t.l.http.HttpService a] I/TSLocationManager(17659): πŸ”΅ HTTP POST: 85ce1685-ce45-4014-85d5-8a85a4a28bb4 I/TSLocationManager(17659): [c.t.l.http.HttpService$h onResponse] I/TSLocationManager(17659): πŸ”΅ Response: 200 D/TSLocationManager(17659): [c.t.l.data.sqlite.b destroy] D/TSLocationManager(17659): βœ… DESTROY: 85ce1685-ce45-4014-85d5-8a85a4a28bb4 D/TSLocationManager(17659): [c.t.l.data.sqlite.b first]

christocracy commented 1 year ago

The plugin does not POST a location in the onHeartbeat event. How are you posting a location in the onHeartbeat event?

christocracy commented 1 year ago

we need the extras other wise we are unable to determine user

You need to do that with Config.extras. It would make more sense to use Config.params for that sort of thing.

I suspect you are manually posting the event.location provided to the onHeartbeat event. That location is stale (the last known location). It is not a freshly recorded location. onHeartbeat does not turn on location-services.

If you want a fresh location in your onHeartbeat event, call upon .getCurrentPosition(options).

github-actions[bot] commented 4 months ago

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

github-actions[bot] commented 4 months ago

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