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

Background geolocation sending few location after walking indoor

Open superyarik opened this issue 2 years ago • 4 comments

Your Environment

  • Plugin version: 4.13.3
  • Platform: Android
  • OS version: 8
  • Device manufacturer / model: samsung s9
  • React Native version (react-native -v): 0.71.8
  • Plugin config
{
            desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
            distanceFilter: 50,
            stopTimeout: 5,
            maxDaysToPersist: 60,
            debug: IS_ANDROID, // <-- enable this hear sounds for background-geolocation life-cycle.
            logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
            stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
            startOnBoot: true, // <-- Auto start tracking when device is powered-up.
            heartbeatInterval: 60 * 5,
            showsBackgroundLocationIndicator: false,
            foregroundService: true,
            enableHeadless: true,
            url: `EDITED`,
            authorization: {
                strategy: 'JWT',
                accessToken: token.accessToken,
                refreshToken: token.refreshToken,
                refreshUrl: url + '/v2/refresh_token',
                refreshPayload: {
                    refresh_token: '{refreshToken}',
                },
                expires: token.expires,
            },

            allowIdenticalLocations: true,
            disableProviderChangeRecord: true,
            locationAuthorizationRequest: 'Always',
            disableLocationAuthorizationAlert: true,
            batchSync: true, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
            autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives.
            autoSyncThreshold: 20, // 20
        }

Expected Behavior

Background geolocation works similar on all trip

Actual Behavior

after mall walking it starts in 10 minutes after start driving(please take a look at 21:25:26.802 walking->in_vehicle and only and only in 21:38:12.832 new location was inserted, Distance from last location: 12157)

Steps to Reproduce

start app with listed config on samsung s9, go to mall(no gps inside)

Context

maybe i need to edit config to prevent this situation?

Debug logs

background-geolocation.log

Maps with great track on the way in and weak on the way out

in out

superyarik avatar Oct 06 '23 23:10 superyarik

I have no idea. There is no config option responsible for that.

christocracy avatar Oct 06 '23 23:10 christocracy

@christocracy please take a look, 2 hours i was inside building, but no state change fired, also 2 hours losted in logs 17:34:28.898 -> 18:24:58.510 18:25:06.369 -> 19:26:02.855

Logs
  ✅  INSERT: 5ceb6052-8020-4396-bacf-36a31d685674
10-07 17:26:44.945 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 654
10-07 17:27:44.931 INFO [ScheduleEvent a] 
╔═════════════════════════════════════════════
║ ⏰ OneShot event fired: MOTION_ACTIVITY_CHECK
╠═════════════════════════════════════════════

10-07 17:27:44.933 INFO [ActivityRecognitionService start] 
  🎾  Start motion-activity updates
10-07 17:27:45.936 DEBUG [AbstractService a] 
  🎾  START [ActivityRecognitionService  startId: 1, eventCount: 1]
10-07 17:27:45.939 DEBUG [ActivityRecognitionService a] 
  🚘 ️DetectedActivity [type=IN_VEHICLE, confidence=96]
10-07 17:27:45.942 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false]
10-07 17:27:45.968 DEBUG [AbstractService a] 
  🎾  START [ActivityRecognitionService  startId: 2, eventCount: 1]
10-07 17:27:45.969 DEBUG [ActivityRecognitionService a] *** wasMoving: true, nowMoving: true, startedMoving: false, justStopped; false
10-07 17:27:45.969 DEBUG [HeadlessTask onHeadlessEvent] 💀  event: activitychange
10-07 17:27:45.969 INFO [ActivityRecognitionService a] 
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🎾  ENTER: in_vehicle
╚═════════════════════════════════════════════
10-07 17:27:45.970 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false]
10-07 17:27:45.970 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 655
10-07 17:27:45.972 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 655
10-07 17:27:46.174 DEBUG [AbstractService f] 
  ⚙️︎  ActivityRecognitionService.stopSelfResult(2): true
10-07 17:27:46.176 DEBUG [AbstractService onDestroy] 
  🔴  ActivityRecognitionService stopped
10-07 17:34:27.277 DEBUG [AbstractService a] 
  🎾  START [TrackingService  startId: 599, eventCount: 1]
10-07 17:34:27.279 INFO [TrackingService b] 
  ℹ️  Location availability: false
10-07 17:34:27.281 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [TrackingService startId: 599, eventCount: 0, sticky: true]
10-07 17:34:28.897 DEBUG [AbstractService a] 
  🎾  START [TrackingService  startId: 600, eventCount: 1]
10-07 17:34:28.898 INFO [TrackingService b] 
  ℹ️  Location availability: true
10-07 17:34:28.898 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [TrackingService startId: 600, eventCount: 0, sticky: true]
10-07 18:24:58.510 DEBUG [HttpService a] 
╔═════════════════════════════════════════════
║ 📶  Connectivity change: connected? false
╠═════════════════════════════════════════════

10-07 18:24:58.513 DEBUG [HeadlessTask onHeadlessEvent] 💀  event: connectivitychange
10-07 18:24:58.517 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 656
10-07 18:24:58.523 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 656
10-07 18:25:05.355 DEBUG [HttpService a] 
╔═════════════════════════════════════════════
║ 📶  Connectivity change: connected? true
╠═════════════════════════════════════════════

10-07 18:25:05.359 DEBUG [HeadlessTask onHeadlessEvent] 💀  event: connectivitychange
10-07 18:25:05.362 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 657
10-07 18:25:05.363 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 657
10-07 18:25:06.369 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 19)
╠═════════════════════════════════════════════

10-07 19:26:02.855 DEBUG [AbstractService a] 
  🎾  START [TrackingService  startId: 601, eventCount: 1]
10-07 19:26:02.860 DEBUG [TrackingService c] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 59.715251,30.427824 hAcc=6.284 et=+7d1h19m38s495ms alt=49.80000305175781 vAcc=0.8766898 vel=4.6298776 sAcc=0.36055514 bear=31.000027 bAcc=4.295448]
╟─ Age: 49ms, time: 1696695962809

10-07 19:26:02.862 DEBUG [TSLocationManager onLocationResult] 
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════

10-07 19:26:02.863 INFO [TSLocationManager onLocationResult] 
  🔵  Re-scaled distanceFilter: 150.0->100.0)
10-07 19:26:02.863 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 300000ms (jobID: -18513055)
10-07 19:26:02.865 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [TrackingService startId: 601, eventCount: 0, sticky: true]
10-07 19:26:02.867 DEBUG [TSLocationManager d] Distance from last location: 153.64734, apparent speed: 0.021465184
10-07 19:26:02.868 DEBUG [TSLocationManager a] Median accuracy: 3.9
10-07 19:26:02.869 DEBUG [TSLocationManager c] Odometer: 95409.195
10-07 19:26:02.882 DEBUG [HeadlessTask onHeadlessEvent] 💀  event: location
10-07 19:26:02.885 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 658
10-07 19:26:02.891 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 658
10-07 19:26:02.945 DEBUG [AbstractService a] 
  🎾  START [TrackingService  startId: 602, eventCount: 1]
10-07 19:26:02.946 DEBUG [TrackingService c] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 59.715251,30.427824 hAcc=6.284 et=+7d1h19m38s495ms alt=49.80000305175781 vAcc=0.8766898 vel=4.6298776 sAcc=0.36055514 bear=31.000027 bAcc=4.295448]
╟─ Age: 136ms, time: 1696695962809

10-07 19:26:02.947 INFO [TSScheduleManager cancelOneShot] 
  ⏰ Cancel OneShot: MOTION_ACTIVITY_CHECK
10-07 19:26:02.949 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 60000ms (jobID: -18513055)
10-07 19:26:02.951 DEBUG [AbstractService a] 
  ⚙️︎   FINISH [TrackingService startId: 602, eventCount: 0, sticky: true]
10-07 19:26:02.952 INFO [SQLiteLocationDAO persist] 
  ✅  INSERT: 37045e19-ba11-4cf9-8b72-2d30ed449b8c

superyarik avatar Oct 07 '23 23:10 superyarik

See https://dontkillmyapp.com.

The OS is responsible for firing events from the motion api.

christocracy avatar Oct 07 '23 23:10 christocracy

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

github-actions[bot] avatar May 03 '24 01:05 github-actions[bot]

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

github-actions[bot] avatar May 18 '24 01:05 github-actions[bot]