react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Background Location Stop Detecting Very Late After Stopped
MAC OS
- Plugin version: "react-native-background-geolocation": "^4.16.0",
- Platform: Android
- OS version: 13
- Device manufacturer / model: Samsung galaxy A14
- React Native version (
react-native -v): "react-native": "0.66.4", - Plugin config
debug: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 100,
stopTimeout: 1,
stopOnTerminate: false,
startOnBoot: true,
stationaryRadius: 25,
elasticityMultiplier: 1,
url: PORTAL_API,
notification: {
title: "Background tracking engaged",
text: "Normal notification text"
},
locationTemplate: '{ "latitude":<%= latitude %>, "longitude":<%= longitude %>, "speed":<%= speed %>, "
batteryLevel": <%= battery.level %> }',
Expected Behavior
The app should trigger a callback from the listener for stationary event once stopped. In the stopTImeout config, it says the no of minutes it should wait inorder to trigger stationary position, i have given the value of one minute for the stopTImeout config option and I have done a few test trips monitoring the adb logs and api calls. The stationary position is always triggered only after 10 minutes.
Actual Behavior
The library is triggering an on stopMotion only after 10 minutes. Is there a way to handle this issue ?
Steps to Reproduce
Context
Tracking location trips from start to end
Debug logs
##RIght after parking the car 06-25 01:31:05.148 13193 29857 I TSLocationManager: ║ Motion Transition Result
06-25 01:31:05.148 13193 29857 I TSLocationManager: ╠═════════════════════════════════════════════
06-25 01:31:05.148 13193 29857 I TSLocationManager: ╟─ 🎾 ENTER: in_vehicle
06-25 01:31:05.148 13193 29857 I TSLocationManager: ╚═════════════════════════════════════════════
06-25 01:31:05.149 13193 29857 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:31:05.149 13193 29857 D TSLocationManager: ⚙️︎ FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false]
06-25 01:31:05.359 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService f]
06-25 01:31:05.359 13193 13193 D TSLocationManager: ⚙️︎ ActivityRecognitionService.stopSelfResult(2): true
06-25 01:31:05.361 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService onDestroy]
06-25 01:31:05.361 13193 13193 D TSLocationManager: 🔴 ActivityRecognitionService stopped
06-25 01:31:10.116 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:31:10.116 13193 13193 D TSLocationManager: 🎾 start [TrackingService startId: 156, eventCount: 1]
06-25 01:31:10.120 13193 13193 I TSLocationManager: [c.t.l.service.TrackingService b]
06-25 01:31:10.120 13193 13193 I TSLocationManager: ℹ️ Location availability: false
06-25 01:31:10.122 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:31:10.122 13193 13193 D TSLocationManager: ⚙️︎ FINISH [TrackingService startId: 156, eventCount: 0, sticky: true]
##A few minutes after parking (10 minutes approx) 06-25 01:40:39.145 13193 30586 I TSLocationManager: ╔═════════════════════════════════════════════
06-25 01:40:39.145 13193 30586 I TSLocationManager: ║ Motion Transition Result
06-25 01:40:39.145 13193 30586 I TSLocationManager: ╠═════════════════════════════════════════════
06-25 01:40:39.145 13193 30586 I TSLocationManager: ╟─ 🔴 EXIT: in_vehicle
06-25 01:40:39.145 13193 30586 I TSLocationManager: ╟─ 🎾 ENTER: still
06-25 01:40:39.145 13193 30586 I TSLocationManager: ╚═════════════════════════════════════════════
06-25 01:40:39.146 13193 30586 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:40:39.146 13193 30586 D TSLocationManager: ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false]
06-25 01:40:39.157 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:40:39.157 13193 13193 D TSLocationManager: 🎾 STOP_TIMEOUT [TrackingService startId: 232, eventCount: 1]
06-25 01:40:39.201 13193 13193 I TSLocationManager: [c.t.l.s.TSScheduleManager oneShot]
06-25 01:40:39.201 13193 13193 I TSLocationManager: ⏰ Scheduled OneShot: STOP_TIMEOUT in 60000ms (jobID: 2059034116)
06-25 01:40:39.211 13193 13193 I TSLocationManager: [c.t.l.l.TSLocationManager d]
06-25 01:40:39.211 13193 13193 I TSLocationManager: 🔴 Location-services: OFF
06-25 01:40:39.214 13193 13193 I TSLocationManager: [c.t.l.l.TSLocationManager requestLocationUpdates]
06-25 01:40:39.214 13193 13193 I TSLocationManager: 🎾 Location-services: ON
06-25 01:40:39.215 13193 13193 D TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
06-25 01:40:39.218 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService a]
06-25 01:40:39.218 13193 13193 D TSLocationManager: ⚙️︎ FINISH [TrackingService startId: 232, eventCount: 0, sticky: true]
06-25 01:40:39.351 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService f]
06-25 01:40:39.351 13193 13193 D TSLocationManager: ⚙️︎ ActivityRecognitionService.stopSelfResult(1): true
06-25 01:40:39.352 13193 13193 D TSLocationManager: [c.t.l.service.AbstractService onDestroy]
06-25 01:40:39.352 13193 13193 D TSLocationManager: 🔴 ActivityRecognitionService stopped
Logs
PASTE_YOUR_LOGS_HERE
!!! Edit your issue and provide all the info !!!
Plugin version: Platform: Android OS version: Device manufacturer / model:
!!! Edit your issue and provide all the info !!!
Plugin version: Platform: Android OS version: Device manufacturer / model:
I have updated the issue with all required info
@christocracy i have done a few more trips and recorded the logs for it.
At this point i'm inside the car and its parked (for more than 5 minutes), i have included some logs below. If you notice it still says thats the Activity is "in_vehicle". How is it possible ? Shouldn’t it trigger a STILL activity ?
6-26 00:09:22.831 16320 21643 I TSLocationManager: ║ Motion Transition Result 06-26 00:09:22.831 16320 21643 I TSLocationManager: ╠═════════════════════════════════════════════ 06-26 00:09:22.831 16320 21643 I TSLocationManager: ╟─ 🎾 ENTER: in_vehicle 06-26 00:09:22.831 16320 21643 I TSLocationManager: ╚═════════════════════════════════════════════ 06-26 00:09:22.832 16320 16409 I ReactNativeJS: 'BackgroundLocationUpdate', '06-26-2024 12:09', [ 'onActivityChange:LISTENER:185++++++', 06-26 00:09:22.832 16320 16409 I ReactNativeJS: { confidence: 100, activity: 'in_vehicle' } ] 06-26 00:09:22.832 16320 21643 D TSLocationManager: [c.t.l.service.AbstractService a] 06-26 00:09:22.832 16320 21643 D TSLocationManager: ⚙️︎ FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false] 06-26 00:09:22.834 16320 16409 I ReactNativeJS: 'BackgroundLocationUpdate', '06-26-2024 12:09', [ 'onActivityChange:LISTENER:185++++++', 06-26 00:09:22.834 16320 16409 I ReactNativeJS: { confidence: 100, activity: 'in_vehicle' } ] 06-26 00:09:22.838 16320 16409 I ReactNativeJS: 'BackgroundLocationUpdate', '06-26-2024 12:09', [ 'onActivityChange:LISTENER:185++++++', 06-26 00:09:22.838 16320 16409 I ReactNativeJS: { confidence: 100, activity: 'in_vehicle' } ] 06-26 00:09:23.041 16320 16320 D TSLocationManager: [c.t.l.service.AbstractService f] 06-26 00:09:23.041 16320 16320 D TSLocationManager: ⚙️︎ ActivityRecognitionService.stopSelfResult(2): true 06-26 00:09:23.046 16320 16320 D TSLocationManager: [c.t.l.service.AbstractService onDestroy] 06-26 00:09:23.046 16320 16320 D TSLocationManager: 🔴 ActivityRecognitionService stopped 06-26 00:09:24.269 16320 16320 D TSLocationManager: [c.t.l.service.AbstractService a] 06-26 00:09:24.269 16320 16320 D TSLocationManager: 🎾 start [TrackingService startId: 155, eventCount: 1] 06-26 00:09:24.271 16320 16320 I TSLocationManager: [c.t.l.service.TrackingService b] 06-26 00:09:24.271 16320 16320 I TSLocationManager: ℹ️ Location availability: true
How is it possible ? Shouldn’t it trigger a STILL activity ?
The Motion api is provided by Google’s closed-source Play Services api. It is a black box with nothing more than an ON/OFF switch. The plug-in has no control over the accuracy or frequency of the results delivered by that API. There is no guarantee of the quality of results, which will vary from device to device.
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.