Closed donmiguel closed 3 weeks ago
π΄ ActivityRecognitionService stopped
this is normal and expected. You are merely misunderstanding this log-entryβs meaning. It only means that the Service assigned to handle events has completed its work and stopped, as itβs supposed to. The plug-in has registered a PendingIntent
with the ActivityTransitionService
(provided by play-services), which will continue to relaunch the plug-inβs ActivityRecognitionService
when another event occurs.
After some time, when the screen is locked, the tracking stops.
βAfter some timeβ as in stopTimeout: 5
.
read the wiki here at this GitHub repo βPhilosophy of Operationβ. Also read the api docs Config.stopTimeout.
You can confirm that the ActivityRecognitionService remains actively tracking motion events by observing the logs while physically shaking your device vigorously to simulate walking. It sometimes helps to shake for a bit (eg 15s) then place it down flat for a few seconds, pick up and shake again.
Thanks for clarifying and pointing to the docs. I get that after the stopTimeout expires and I am not moving the plugin enters the stationary state. However, in my case, the app stops tracking while I am moving. Location authorization is set to always.
Huawai P20
This is one of the worst-performing devices on earth. I own one.
I agree. Tests with a Pixel device are looking better.
Your Environment
react-native -v
): 12.1.1Expected Behavior
The app should run configured as headless in the background to track movements.
Actual Behavior
After a certain time, when the screen is locked, the tracking stops.
Steps to Reproduce
Context
Debug logs
Last logs entries
``` 04-18 15:00:01.163 DEBUG [AbstractService a] πΎ start [ActivityRecognitionService startId: 1, eventCount: 1] 04-18 15:00:01.166 DEBUG [ActivityRecognitionService a] π οΈDetectedActivity [type=IN_VEHICLE, confidence=96] 04-18 15:00:01.176 DEBUG [AbstractService a] βοΈοΈ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] 04-18 15:00:01.303 DEBUG [AbstractService a] πΎ start [ActivityRecognitionService startId: 2, eventCount: 1] 04-18 15:00:01.305 DEBUG [ActivityRecognitionService a] *** wasMoving: true, nowMoving: true, startedMoving: false, justStopped; false 04-18 15:00:01.306 DEBUG [HeadlessTask onHeadlessEvent] π event: activitychange 04-18 15:00:01.307 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 39 04-18 15:00:01.311 INFO [ActivityRecognitionService a] ββββββββββββββββββββββββββββββββββββββββββββββ β Motion Transition Result β βββββββββββββββββββββββββββββββββββββββββββββ ββ πΎ ENTER: in_vehicle ββββββββββββββββββββββββββββββββββββββββββββββ 04-18 15:00:01.311 DEBUG [AbstractService a] βοΈοΈ FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false] 04-18 15:00:01.327 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 39 04-18 15:00:01.516 DEBUG [AbstractService f] βοΈοΈ ActivityRecognitionService.stopSelfResult(2): true 04-18 15:00:01.517 DEBUG [AbstractService onDestroy] π΄ ActivityRecognitionService stopped 04-18 15:00:03.631 DEBUG [AbstractService a] πΎ start [TrackingService startId: 34, eventCount: 1] 04-18 15:00:03.632 DEBUG [TrackingService c] ββββββββββββββββββββββββββββββββββββββββββββββ β TrackingService: LocationResult β βββββββββββββββββββββββββββββββββββββββββββββ ββ π Location[fused 47******,10****** hAcc=4 et=+6d0h25m57s351ms alt=544.0 vel=12.029285 bear=317.0 vAcc=5 sAcc=0 bAcc=0 {Bundle[mParcelledData.dataSize=412]}] ββ Age: 43ms, time: 1713445203588 04-18 15:00:03.633 DEBUG [TSLocationManager onLocationResult] ββββββββββββββββββββββββββββββββββββββββββββββ β Process LocationResult β βββββββββββββββββββββββββββββββββββββββββββββ 04-18 15:00:03.634 DEBUG [TSLocationManager d] Distance from last location: 36.260777, apparent speed: 12.115194 04-18 15:00:03.634 DEBUG [TSLocationManager a] Median accuracy: 4.0 04-18 15:00:03.635 DEBUG [TSLocationManager c] Odometer: 48759.13 04-18 15:00:03.643 INFO [TSScheduleManager cancelOneShot] β° Cancel OneShot: MOTION_ACTIVITY_CHECK 04-18 15:00:03.659 INFO [TSScheduleManager oneShot] β° Scheduled OneShot: MOTION_ACTIVITY_CHECK in 62993ms (jobID: -18513055) 04-18 15:00:03.664 DEBUG [AbstractService a] βοΈοΈ FINISH [TrackingService startId: 34, eventCount: 0, sticky: true] 04-18 15:00:03.676 DEBUG [HeadlessTask onHeadlessEvent] π event: location 04-18 15:00:03.679 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 40 04-18 15:00:03.683 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 40 04-18 15:00:03.694 INFO [SQLiteLocationDAO persist] β INSERT: 4829b1f4-a021-4637-9531-88962d698607 ```