transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.63k stars 426 forks source link

Background track not working properly in Android for some devices only #1730

Closed samp84531 closed 1 year ago

samp84531 commented 1 year ago

Your Environment

/**

### Index.js

import { AppRegistry } from 'react-native'; import App from './App'; import { name as appName } from './app.json';

import BackgroundGeolocation from "react-native-background-geolocation"; import BackgroundFetch from "react-native-background-fetch";

const BackgroundGeolocationHeadlessTask = async (event) => { let params = event.params; console.log('[BackgroundGeolocation HeadlessTask] -', event.name, params); switch (event.name) { case 'heartbeat': break; case 'authorization': BackgroundGeolocation.setConfig({ url: 'API URL', }); break; } }

BackgroundGeolocation.registerHeadlessTask(BackgroundGeolocationHeadlessTask);

const BackgroundFetchHeadlessTask = async (event) => { console.log('[BackgroundFetch HeadlessTask] start', event.taskId);

if (event.taskId == 'react-native-background-fetch') {

}

console.log('[BackgroundFetch HeadlessTask] finished');

BackgroundFetch.finish(event.taskId);

}

BackgroundFetch.registerHeadlessTask(BackgroundFetchHeadlessTask); AppRegistry.registerComponent(appName, () => App);

### This code initializes once I come to this screen

useEffect(() => {

        const subscription = BackgroundGeolocation.onHttp((response) => {
              let status = response.status;
              let success = response.success;
              let responseText = response.responseText;
              // console.log("[onHttp] ");
        });

        // Ready the SDK and fetch the current state.
        const stated = await BackgroundGeolocation.ready({
              url: "api url",
              autoSync: true,
              autoSyncThreshold: 5,
              batchSync: true,
              maxBatchSize: 50,
              headers: {
                    AUTHENTICATION_TOKEN: "key"
              },
              params: {
                    'auth_id': props.userdata?.data?.id,
                    'auth_user_type': props.userdata?.user_type,
              },
              locationsOrderDirection: "DESC",
              desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION,
              stopTimeout: 5,

              maxDaysToPersist: 14,
              enableHeadless: true,
              distanceFilter: 3,
              startOnBoot: true,
              stopOnTerminate: false,
              locationAuthorizationRequest: 'Always',
              backgroundPermissionRationale: {
                    title: "Allow {applicationName} to access this device's location even when closed or not in use.",
                    message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
                    positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
                    negativeAction: 'Cancel'
              }
        }, (state) => {
              console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
              if (!state.enabled) {
                    BackgroundGeolocation.start(function () {
                          console.log("- Start success");
                    });
              }
      })
        setIsMoving(stated?.isMoving  ?? false);  // <-- TODO re-define @prop isMoving? as REQUIRED in State
  })

### When the user clicks on start I call this code to detect background location and I give the user starting point API as lat long 
  const fetchLocationOnTime = async (callback) => {
        let location = await BackgroundGeolocation.getCurrentPosition({
              timeout: 30,          // 30 second timeout to fetch location
              persist: true,        // Defaults to state.enabled
              maximumAge: 5000,     // Accept the last-known-location if not older than 5000 ms.
              desiredAccuracy: 0,  // Try to fetch a location with an accuracy of `10` meters.
              samples: 1,           // How many location samples to attempt.
              extras: {             // Custom meta-data.
                    "route_id": 123
              }
        });
        console.log('location', location);
        let locationUpdate = { latitude: location.coords.latitude, longitude: location.coords.longitude }
        props.geolocation(locationUpdate);
        callback(location);
  }


## Expected Behavior
<!--- Tell us what should happen -->
I need accurate tracking on all devices

<img width="904" alt="Screenshot 2023-06-30 at 10 46 11 AM" src="https://github.com/transistorsoft/react-native-background-geolocation/assets/92366978/122fb51c-975d-4ae3-910e-f99d6824dbe5">

## Actual Behavior
<!--- Tell us what happens instead -->

### This is a Motorola  both device's directions track, and also I tracked three devices simultaneously and track work in only one device but not work for the other two Motorola devices

<img width="531" alt="Screenshot 2023-06-30 at 10 46 53 AM" src="https://github.com/transistorsoft/react-native-background-geolocation/assets/92366978/c15a744d-76d8-47e0-88cd-feb087d99510">
<img width="503" alt="Screenshot 2023-06-30 at 10 46 31 AM" src="https://github.com/transistorsoft/react-native-background-geolocation/assets/92366978/97fc2185-f77b-4538-9176-3959455a8d3b">

## Context
<!--- What were you trying to do? -->

I need accurate tracking on all devices  and  i tracked three devices simultaneously and track work in only one device but not work for the other two Motorola devices
samp84531 commented 1 year ago

Hello @christocracy I have another issue on the variation,

const stated = await BackgroundGeolocation.ready({ url: "URL", autoSync: true, autoSyncThreshold: 5, batchSync: true, maxBatchSize: 25, headers: { AUTHENTICATION_TOKEN: "KEY" }, params: { 'auth_id': props.userdata?.data?.id, 'auth_user_type': props.userdata?.user_type, }, locationsOrderDirection: "DESC", locationAuthorizationRequest: 'Always', logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, debug: true,

              desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
              distanceFilter: 10,
              // stationaryRadius: 0,
              stopTimeout: 5,
              disableElasticity: true,
              maxDaysToPersist: 1,
              enableHeadless: true,
              startOnBoot: true,
              stopOnTerminate: false,
              backgroundPermissionRationale: {
                    title: "Allow {applicationName} to access this device's location even when closed or not in use.",
                    message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
                    positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
                    negativeAction: 'Cancel'
              }
        }, (state) => {
              console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
              if (!state.enabled) {
                    console.log('hi sam');
                    BackgroundGeolocation.start(function () {
                          console.log("- Start success");
                    });
              }
        })
samp84531 commented 1 year ago
Screenshot 2023-08-28 at 4 40 25 PM
christocracy commented 1 year ago

You can expect to see periodic, poor-accuracy locations due to the laws of physics. Particularly when the device is indoors. GPS only works outdoors.

Use Location.coords.accuracy to filter-out undesired locations.

samp84531 commented 1 year ago

Hello @christocracy, After a long time, I'm facing one issue from the SDK side.

OS: Android Model: VIVO V2158 Android Version: 13 Plugin Version: 4.13.1

issue: After starting tracking, it ran properly for 2 hours, then stopped automatically and started again after 2-3 hours and logs are also missing in the report.

issue logs Specific time logs: ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════ 09-05 13:54:45.143 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.516 09-05 13:54:45.154 INFO [b persist] ✅ INSERT: a8197722-7a6b-4f01-82d1-98277def5408 09-05 13:54:45.347 INFO [HttpService$f onResponse] 🔵 Response: 200 09-05 13:54:45.348 DEBUG [b destroyAll] ✅ DELETED: (1) 09-05 13:54:45.360 DEBUG [b allWithLocking] ✅ Locked 1 records 09-05 13:54:45.360 INFO [HttpService a] 🔵 HTTP POST batch (1) 09-05 13:54:46.146 INFO [HttpService$f onResponse] 🔵 Response: 200 09-05 13:54:46.148 DEBUG [b destroyAll] ✅ DELETED: (1) 09-05 13:54:46.151 DEBUG [b allWithLocking] ✅ Locked 0 records 09-05 13:54:46.151 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 319 09-05 13:55:14.901 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 5, eventCount: 1] 09-05 13:55:14.901 DEBUG [TrackingService handleLocationResult] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=3.9 et=+10h51m32s18ms alt=102.20000000000002 vAcc=15.5 vel=0.03269622 sAcc=0.8] ╟─ Age: 159ms, time: 1693902314742 09-05 13:55:14.902 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════ 09-05 13:55:14.902 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 118.576195, apparent speed: 3.9876308 09-05 13:55:14.903 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.516 09-05 13:55:14.903 DEBUG [TSLocationManager incrementOdometer] Odometer: 26087.188 09-05 13:55:14.906 INFO [TrackingService performStopDetection] ℹ️ Distance from stoppedAtLocation: 78.52587 09-05 13:55:14.906 DEBUG [TrackingService performStopDetection] ℹ️ Force cancel cancel stopTimeout due to apparent movement beyond stoppedAt location 09-05 13:55:14.909 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: STOP_TIMEOUT 09-05 13:55:14.912 INFO [b persist] ✅ INSERT: 4bff93df-5686-4ad6-b810-f265ff0ee128 09-05 13:55:14.924 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 89736ms (jobID: -18513055) 09-05 13:55:14.928 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 5, eventCount: 0, sticky: true] 09-05 13:55:15.874 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 6, eventCount: 1] 09-05 13:55:15.875 DEBUG [TrackingService handleLocationResult] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=3.9 et=+10h51m33s18ms alt=102.20000000000002 vAcc=14.9 vel=0.033619266 sAcc=1.6] ╟─ Age: 132ms, time: 1693902315742 09-05 13:55:15.876 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════ 09-05 13:55:15.876 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 38.630817, apparent speed: 38.630817 09-05 13:55:15.876 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: STOP_TIMEOUT in 300000ms (jobID: 2059034116) 09-05 13:55:15.877 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.516 09-05 13:55:15.877 DEBUG [TSLocationManager incrementOdometer] Odometer: 26125.818 09-05 13:55:15.882 INFO [TSScheduleManager cancelOneShot] ⏰ Cancel OneShot: MOTION_ACTIVITY_CHECK 09-05 13:55:15.885 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 6, eventCount: 0, sticky: true] 09-05 13:55:15.893 INFO [b persist] ✅ INSERT: c7482f50-c2db-4726-b612-31999a4cab04 09-05 13:55:16.886 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 7, eventCount: 1] 09-05 13:55:16.887 DEBUG [TrackingService handleLocationResult] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=3.9 et=+10h51m34s18ms alt=102.20000000000002 vAcc=15.0 vel=0.04253319 sAcc=1.7] ╟─ Age: 144ms, time: 1693902316742 09-05 13:55:16.887 INFO [TrackingService performStopDetection] ℹ️ Distance from stoppedAtLocation: 4.625818 09-05 13:55:16.887 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 7, eventCount: 0, sticky: true] 09-05 13:55:16.889 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════ 09-05 13:55:16.890 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 12.425818, apparent speed: 12.425818 09-05 13:55:16.890 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.9 09-05 13:55:16.890 DEBUG [TSLocationManager incrementOdometer] Odometer: 26138.244 09-05 13:55:16.904 INFO [b persist] ✅ INSERT: b5ec1fb1-0b11-4e05-9d73-3ae1dd896dec 09-05 14:00:53.300 INFO [ScheduleEvent onOneShot] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: STOP_TIMEOUT ╠═════════════════════════════════════════════ 09-05 14:00:53.303 DEBUG [TSConfig d] ℹ️ Persist config, dirty: [isMoving] 09-05 14:00:53.306 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-05 14:00:53.308 INFO [TSLocationManager removeLocationUpdates] 🔴 Location-services: OFF 09-05 14:00:53.310 INFO [TrackingService changePace] 🔵 setPace: true → false 09-05 14:00:53.332 INFO [TSLocationManager logSingleLocationResult] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 14 (591ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=3.9 et=+10h57m10s17ms alt=90.4 vAcc=12.9 vel=3.714985E-4 sAcc=1.5], time: 1693902652741 09-05 14:00:53.334 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 09-05 14:00:53.334 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.9 09-05 14:00:53.343 INFO [b persist] ✅ INSERT: 968dabbf-95ff-421b-ac32-49d5ebe78fa7 09-05 14:00:53.344 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 22.3995681,70.9464639 hAcc=3.9) 09-05 14:00:53.360 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 4) ╠═════════════════════════════════════════════ 09-05 14:00:53.363 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 8, eventCount: 1] 09-05 14:00:53.363 INFO [TrackingService handleMotionChangeResult] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 09-05 14:00:53.372 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 8, eventCount: 0, sticky: false] 09-05 14:00:53.435 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 320 09-05 14:00:53.438 DEBUG [b allWithLocking] ✅ Locked 4 records 09-05 14:00:53.439 INFO [HttpService a] 🔵 HTTP POST batch (4) 09-05 14:00:53.579 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ TrackingService.stopSelfResult(8): true 09-05 14:00:53.579 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 09-05 14:00:55.713 INFO [HttpService$f onResponse] 🔵 Response: 200 09-05 14:00:55.715 DEBUG [b destroyAll] ✅ DELETED: (4) 09-05 14:00:55.718 DEBUG [b allWithLocking] ✅ Locked 0 records 09-05 14:00:55.719 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 320 09-05 14:04:55.717 DEBUG [AbstractService start] 🎾 START [GeofencingService [startId: 1, eventCount: 1] 09-05 14:04:55.721 DEBUG [TSConfig d] ℹ️ Persist config, dirty: [isMoving] 09-05 14:04:55.723 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-05 14:04:55.724 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 09-05 14:04:55.743 INFO [TrackingService changePace] 🔵 setPace: false → true 09-05 14:04:55.744 INFO [GeofencingService handleStationaryGeofenceExit] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=699.999 et=+11h1m11s898ms alt=90.4 vAcc=12.9] 09-05 14:04:55.745 DEBUG [AbstractService finish] ⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false] 09-05 14:04:55.755 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 1, eventCount: 1] 09-05 14:04:55.756 INFO [TrackingService handleMotionChangeResult] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════ 09-05 14:04:55.756 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: true] 09-05 14:04:55.761 INFO [TSLocationManager logSingleLocationResult] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 15 (1138ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=699.999 et=+11h1m11s898ms alt=90.4 vAcc=12.9], time: 1693902894622 09-05 14:04:55.761 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.9 09-05 14:04:55.765 DEBUG [c h] ℹ️ LocationAuthorization: Permission granted 09-05 14:04:55.789 DEBUG [AbstractService start] 🎾 START [LocationRequestService [startId: 1, eventCount: 1] 09-05 14:04:55.791 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 1, requestId: 15] 09-05 14:04:55.793 DEBUG [AbstractService finish] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 09-05 14:04:55.948 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ GeofencingService.stopSelfResult(1): true 09-05 14:04:55.949 DEBUG [AbstractService onDestroy] 🔴 GeofencingService stopped 09-05 14:05:02.141 DEBUG [AbstractService start] 🎾 START [LocationRequestService [startId: 2, eventCount: 1] 09-05 14:05:02.145 INFO [TSLocationManager logSingleLocationResult] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 15 (151ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=8.4 et=+11h1m19s269ms alt=98.6 vAcc=18.8 vel=0.0 sAcc=2.4], time: 1693902901994 09-05 14:05:02.151 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: true 09-05 14:05:02.153 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.9 09-05 14:05:02.158 INFO [TSLocationManager requestLocationUpdates] 🎾 Location-services: ON 09-05 14:05:02.161 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1 09-05 14:05:02.166 DEBUG [AbstractService finish] ⚙️︎ FINISH [LocationRequestService startId: 2, eventCount: 1, sticky: false] 09-05 14:05:02.166 INFO [b persist] ✅ INSERT: 31c11c6e-e1dc-4957-b2e0-08bfe520d2af 09-05 14:05:02.168 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════ 09-05 14:05:02.170 DEBUG [AbstractService stop] 🎾 STOP [LocationRequestService startId: 3, eventCount: 1] 09-05 14:05:02.170 DEBUG [AbstractService finish] ⚙️︎ FINISH [LocationRequestService startId: 3, eventCount: 0, sticky: false] 09-05 14:05:02.171 INFO [ActivityRecognitionService start] 🎾 Start motion-activity updates 09-05 14:05:02.209 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 2, eventCount: 1] 09-05 14:05:02.210 DEBUG [TrackingService handleLocationResult] ╔═════════════════════════════════════════════ ║ TrackingService: LocationResult ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=8.4 et=+11h1m19s269ms alt=98.6 vAcc=18.8 vel=0.0 sAcc=2.4] ╟─ Age: 216ms, time: 1693902901994 09-05 14:05:02.210 DEBUG [TSLocationManager onLocationResult] ╔═════════════════════════════════════════════ ║ Process LocationResult ╠═════════════════════════════════════════════ 09-05 14:05:02.210 DEBUG [TSLocationManager onLocationResult] ℹ️ IGNORED: same as last location 09-05 14:05:02.210 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 2, eventCount: 0, sticky: true] 09-05 14:05:02.215 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 321 09-05 14:05:02.219 DEBUG [b allWithLocking] ✅ Locked 1 records 09-05 14:05:02.219 INFO [HttpService a] 🔵 HTTP POST batch (1) 09-05 14:05:02.285 DEBUG [AbstractService start] 🎾 START [ActivityRecognitionService [startId: 1, eventCount: 1] 09-05 14:05:02.286 DEBUG [ActivityRecognitionService handleActivityRecognitionResult] 🚘 ️DetectedActivity [type=STILL, confidence=100] 09-05 14:05:02.288 DEBUG [AbstractService finish] ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] 09-05 14:05:02.340 DEBUG [AbstractService start] 🎾 START [ActivityRecognitionService [startId: 2, eventCount: 1] 09-05 14:05:02.341 DEBUG [ActivityRecognitionService handleActivityTransitionResult] *** wasMoving: true, nowMoving: false, startedMoving: false, justStopped; true 09-05 14:05:02.344 INFO [ActivityRecognitionService handleActivityTransitionResult] ╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🎾 ENTER: still ╚═════════════════════════════════════════════ 09-05 14:05:02.344 DEBUG [AbstractService finish] ⚙️︎ FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false] 09-05 14:05:02.354 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 3, eventCount: 1] 09-05 14:05:02.355 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: STOP_TIMEOUT in 300000ms (jobID: 2059034116) 09-05 14:05:02.357 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 3, eventCount: 0, sticky: true] 09-05 14:05:02.373 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ LocationRequestService.stopSelfResult(3): true 09-05 14:05:02.374 DEBUG [AbstractService onDestroy] 🔴 LocationRequestService stopped 09-05 14:05:02.558 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ ActivityRecognitionService.stopSelfResult(2): true 09-05 14:05:02.559 DEBUG [AbstractService onDestroy] 🔴 ActivityRecognitionService stopped 09-05 14:05:04.575 INFO [HttpService$f onResponse] 🔵 Response: 200 09-05 14:05:04.576 DEBUG [b destroyAll] ✅ DELETED: (1) 09-05 14:05:04.580 DEBUG [b allWithLocking] ✅ Locked 0 records 09-05 14:05:04.581 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 321 09-05 14:10:02.376 INFO [ScheduleEvent onOneShot] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: STOP_TIMEOUT ╠═════════════════════════════════════════════ 09-05 14:10:02.385 DEBUG [TSConfig d] ℹ️ Persist config, dirty: [isMoving] 09-05 14:10:02.396 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-05 14:10:02.401 INFO [TSLocationManager removeLocationUpdates] 🔴 Location-services: OFF 09-05 14:10:02.410 INFO [TrackingService changePace] 🔵 setPace: true → false 09-05 14:10:02.470 INFO [TSLocationManager logSingleLocationResult] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 16 (734ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=3.9 et=+11h6m19s11ms alt=96.20000000000002 vAcc=10.2 vel=0.0 sAcc=1.5], time: 1693903201735 09-05 14:10:02.472 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 09-05 14:10:02.472 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 3.9 09-05 14:10:02.482 INFO [b persist] ✅ INSERT: cf7b378c-56e7-4ff8-b00a-0efba238929d 09-05 14:10:02.484 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════ 09-05 14:10:02.495 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 22.399575,70.9464817 hAcc=3.9) 09-05 14:10:02.516 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 4, eventCount: 1] 09-05 14:10:02.517 INFO [TrackingService handleMotionChangeResult] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 09-05 14:10:02.530 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 4, eventCount: 0, sticky: false] 09-05 14:10:02.550 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 322 09-05 14:10:02.552 DEBUG [b allWithLocking] ✅ Locked 1 records 09-05 14:10:02.553 INFO [HttpService a] 🔵 HTTP POST batch (1) 09-05 14:10:02.732 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ TrackingService.stopSelfResult(4): true 09-05 14:10:02.733 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 09-05 14:10:05.390 INFO [HttpService$f onResponse] 🔵 Response: 200 09-05 14:10:05.396 DEBUG [b destroyAll] ✅ DELETED: (1) 09-05 14:10:05.400 DEBUG [b allWithLocking] ✅ Locked 0 records 09-05 14:10:05.407 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 322 09-05 15:23:31.850 DEBUG [AbstractService start] 🎾 START [GeofencingService [startId: 1, eventCount: 1] 09-05 15:23:31.877 DEBUG [TSConfig d] ℹ️ Persist config, dirty: [isMoving] 09-05 15:23:31.883 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-05 15:23:31.891 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 09-05 15:23:31.937 INFO [TrackingService changePace] 🔵 setPace: false → true 09-05 15:23:31.938 INFO [GeofencingService handleStationaryGeofenceExit] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=82.5 et=+12h19m48s953ms alt=98.30000305175781 vAcc=13.58449] 09-05 15:23:31.943 DEBUG [AbstractService finish] ⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false] 09-05 15:23:31.957 DEBUG [AbstractService start] 🎾 START [TrackingService [startId: 1, eventCount: 1] 09-05 15:23:31.957 INFO [TrackingService handleMotionChangeResult] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════ 09-05 15:23:31.958 DEBUG [AbstractService finish] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: true] 09-05 15:23:31.994 INFO [TSLocationManager logSingleLocationResult] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 17 (317ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused *** hAcc=82.5 et=+12h19m48s953ms alt=98.30000305175781 vAcc=13.58449], time: 1693907611677 09-05 15:23:32.002 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 8.4 09-05 15:23:32.013 DEBUG [c h] ℹ️ LocationAuthorization: Permission granted 09-05 15:23:32.032 DEBUG [AbstractService start] 🎾 START [LocationRequestService [startId: 1, eventCount: 1] 09-05 15:23:32.038 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 1, requestId: 17] 09-05 15:23:32.053 DEBUG [AbstractService finish] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 09-05 15:23:32.181 DEBUG [AbstractService lambda$runFinishDelayed$0$com-transistorsoft-locationmanager-service-AbstractService] ⚙️︎ GeofencingService.stopSelfResult(1): true 09-05 15:23:32.187 DEBUG [AbstractService onDestroy] 🔴 GeofencingService stopped 09-05 15:23:33.440 DEBUG [AbstractService start] 🎾 START [LocationRequestService [startId: 2, eventCount: 1] 09-05 15:23:33.442 INFO [TSLocationManager logSingleLocationResult]
samp84531 commented 1 year ago
Screenshot 2023-09-08 at 2 35 02 PM
christocracy commented 1 year ago

Model: VIVO V2158

Vivo devices are known to be unreliable. See https://dontkillmyapp.com my

samp84531 commented 1 year ago

hello @christocracy The above issue is also happening in Redmi devices

OS: Android Model: Xiaomi Redmi Note 5 Pro Android Version: 13 Plugin Version: 4.13.3

issue: After starting tracking, it ran properly for 2 hours, then stopped automatically and started again after 2-3 hours and logs are also missing in the report.

check the log between 09-14 15:44:57 - 09-14 20:36:13.322 DEBUG

issue logs ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 09-14 15:44:53.778 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 5, eventCount: 0, sticky: false] 09-14 15:44:53.834 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 214 09-14 15:44:53.838 DEBUG [SQLiteLocationDAO allWithLocking] ✅ Locked 3 records 09-14 15:44:53.839 INFO [HttpService a] 🔵 HTTP POST batch (3) 09-14 15:44:53.980 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(5): true 09-14 15:44:53.981 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 09-14 15:44:55.451 INFO [HttpService$f onResponse] 🔵 Response: 200 09-14 15:44:55.452 DEBUG [SQLiteLocationDAO destroyAll] ✅ DELETED: (3) 09-14 15:44:55.452 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: http 09-14 15:44:55.454 DEBUG [SQLiteLocationDAO allWithLocking] ✅ Locked 0 records 09-14 15:44:55.455 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 214 09-14 15:44:55.459 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1437 09-14 15:44:55.466 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1437 09-14 15:44:57.153 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 15:44:57.156 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:44:57.160 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1438 09-14 15:44:57.183 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1438 09-14 15:44:58.196 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 15:45:06.789 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 15:45:06.789 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:45:06.791 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1439 09-14 15:45:06.795 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1439 09-14 15:45:07.833 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 15:46:18.331 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 15:46:18.333 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:46:18.335 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1440 09-14 15:46:18.350 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1440 09-14 15:46:19.337 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 15:54:57.590 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? false ╠═════════════════════════════════════════════ 09-14 15:54:57.594 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:54:57.595 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1443 09-14 15:54:57.620 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1443 09-14 15:54:58.906 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 15:54:58.910 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:54:58.912 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1444 09-14 15:54:58.938 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1444 09-14 15:54:59.269 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 15:54:59.283 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 15:54:59.284 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1445 09-14 15:54:59.302 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1445 09-14 15:54:59.982 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 15:55:00.309 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 16:04:14.419 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 16:04:14.422 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 16:04:14.424 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1449 09-14 16:04:14.427 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1449 09-14 16:04:15.463 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 09-14 16:17:46.444 INFO [TSProviderManager a] ╔═════════════════════════════════════════════ ║ Location-provider change: true ╠═════════════════════════════════════════════ ╟─ GPS: true ╟─ Network: false ╟─ AP Mode: false 09-14 16:17:46.446 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: providerchange 09-14 16:17:46.454 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1453 09-14 16:17:46.456 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1453 09-14 16:17:46.469 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? false ╠═════════════════════════════════════════════ 09-14 16:17:46.471 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 16:17:46.472 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1454 09-14 16:17:46.477 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1454 09-14 16:17:46.527 DEBUG [TSGeofenceManager$f run] ╔═════════════════════════════════════════════ ║ TSGeofenceManager monitoring 0/0 ╠═════════════════════════════════════════════ ╚═════════════════════════════════════════════ 09-14 16:17:46.528 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: geofenceschange 09-14 16:17:46.529 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1455 09-14 16:17:46.536 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1455 09-14 16:17:46.707 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ providerchange LocationResult: 46 (174304ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.302526,70.814153 hAcc=100 et=+6d8h25m58s450ms alt=84.80000305175781 vAcc=100 sAcc=??? bAcc=??? {Bundle[{}]}], time: 1694688292402 09-14 16:17:46.708 DEBUG [TSLocationManager a] Median accuracy: 20.725 09-14 16:17:46.715 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: location 09-14 16:17:46.720 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1456 09-14 16:17:46.721 DEBUG [LocationAuthorization withPermission] ℹ️ LocationAuthorization: Permission granted 09-14 16:17:46.730 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1456 09-14 16:17:46.770 DEBUG [AbstractService a] 🎾 START [LocationRequestService startId: 1, eventCount: 1] 09-14 16:17:46.771 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 3, requestId: 46] 09-14 16:17:46.777 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 09-14 16:17:47.669 DEBUG [AbstractService a] 🎾 START [LocationRequestService startId: 2, eventCount: 1] 09-14 16:17:47.671 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ providerchange LocationResult: 46 (686ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.302629,70.814178 hAcc=17 et=+6d8h28m53s31ms alt=84.80000305175781 vAcc=1 sAcc=??? bAcc=??? {Bundle[{noGPSLocation=Location[fused 22.302629,70.814178 hAcc=17 et=+6d8h28m53s31ms alt=84.80000305175781 vAcc=1 sAcc=??? bAcc=??? {Bundle[mParcelledData.dataSize=360]}], requestId=46}]}], time: 1694688466984 09-14 16:17:47.673 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired providerchange position 09-14 16:17:47.676 DEBUG [TSLocationManager a] Median accuracy: 20.0 09-14 16:17:47.682 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 2, eventCount: 0, sticky: false] 09-14 16:17:47.683 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: location 09-14 16:17:47.684 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1457 09-14 16:17:47.689 DEBUG [TSLocationManager$c onLocation] ℹ️ Distance from last location: 49.64405 09-14 16:17:47.689 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1457 09-14 16:17:47.691 INFO [SQLiteLocationDAO persist] ✅ INSERT: 17171ae3-5a50-440a-bd15-2637b4441653 09-14 16:17:47.728 DEBUG [AbstractService b] 🎾 STOP [LocationRequestService startId: 3, eventCount: 1] 09-14 16:17:47.729 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 3, eventCount: 0, sticky: false] 09-14 16:17:47.937 DEBUG [AbstractService f] ⚙️︎ LocationRequestService.stopSelfResult(3): true 09-14 16:17:47.938 DEBUG [AbstractService onDestroy] 🔴 LocationRequestService stopped 09-14 16:17:48.239 DEBUG [HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 09-14 16:17:48.244 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: connectivitychange 09-14 16:17:48.246 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1458 09-14 16:17:48.278 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1458 09-14 16:17:49.275 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════ 09-14 20:36:13.322 DEBUG [AbstractService a] 🎾 START [ActivityRecognitionService startId: 1, eventCount: 1] 09-14 20:36:13.382 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: activitychange 09-14 20:36:13.382 DEBUG [ActivityRecognitionService a] *** wasMoving: false, nowMoving: true, startedMoving: true, justStopped; false 09-14 20:36:13.394 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1478 09-14 20:36:13.395 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 09-14 20:36:13.399 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-14 20:36:13.410 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1478 09-14 20:36:13.414 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 09-14 20:36:13.432 INFO [TrackingService changePace] 🔵 setPace: false → true 09-14 20:36:13.433 INFO [ActivityRecognitionService a] ╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🔴 EXIT: still ╟─ 🎾 ENTER: in_vehicle ╚═════════════════════════════════════════════ 09-14 20:36:13.434 DEBUG [AbstractService a] ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] 09-14 20:36:13.449 DEBUG [AbstractService a] 🎾 START [TrackingService startId: 1, eventCount: 1] 09-14 20:36:13.450 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════ 09-14 20:36:13.451 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: true] 09-14 20:36:13.511 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 47 (83213ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.302701,70.814436 hAcc=20 et=+6d12h45m56s531ms alt=87.9000015258789 vAcc=3 sAcc=??? bAcc=??? {Bundle[{}]}], time: 1694703890297 09-14 20:36:13.512 DEBUG [TSLocationManager a] Median accuracy: 20.0 09-14 20:36:13.521 DEBUG [HeadlessTask onHeadlessEvent] 💀 event: location 09-14 20:36:13.526 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1479 09-14 20:36:13.543 DEBUG [LocationAuthorization withPermission] ℹ️ LocationAuthorization: Permission granted 09-14 20:36:13.544 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1479 09-14 20:36:13.570 DEBUG [AbstractService a] 🎾 START [LocationRequestService startId: 1, eventCount: 1] 09-14 20:36:13.572 INFO [SingleLocationRequest startUpdatingLocation] 🔵 [SingleLocationRequest start, action: 1, requestId: 47] 09-14 20:36:13.574 DEBUG [AbstractService a] ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] 09-14 20:36:13.635 DEBUG [AbstractService f] ⚙️︎ ActivityRecognitionService.stopSelfResult(1): true 09-14 20:36:13.636 DEBUG [AbstractService onDestroy] 🔴 ActivityRecognitionService stopped 09-14 20:36:16.426 DEBUG [AbstractService a] 🎾 START [LocationRequestService startId: 2, eventCount: 1] 09-14 20:36:16.428 INFO [TSLocationManager a]
Screenshot 2023-09-15 at 11 00 15 AM Screenshot 2023-09-15 at 11 03 47 AM
christocracy commented 1 year ago

Chinese devices in general are horrible. It’s well known that these manufacturers modify their flavour of Android to prevent services from working properly in the background.

Redmi, vivo, Huawei.

see https://dontkillmyapp.com

samp84531 commented 1 year ago

I was here for 3-4 hours and then I started tracking again.

Screenshot 2023-09-15 at 11 13 06 AM
samp84531 commented 1 year ago

@christocracy

I follow this blog every time before starting tracking https://dontkillmyapp.com/

samp84531 commented 1 year ago

Hello @christocracy, The above issue is also happening in Samsung SM-M317F, and I follow this blog every time before starting tracking https://dontkillmyapp.com/

OS: Android Model: samsung SM-M317F Android Version: 13 Plugin Version: 4.13.3

issue: After starting tracking, it ran properly for 1 hour, then stopped automatically and started again after 10mins, and logs are also missing in the report.

Missing log time is 09-16 15:31:33.890 - 09-16 15:36:38.501

issue logs 09-16 15:31:33.849 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 09-16 15:31:33.858 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-16 15:31:33.861 INFO [TSLocationManager d] 🔴 Location-services: OFF 09-16 15:31:33.865 INFO [TrackingService changePace] 🔵 setPace: true → false 09-16 15:31:33.888 INFO [TSLocationManager a] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 8 (379ms old) ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.303948,70.819926 hAcc=5.0 et=+83d20h46m39s674ms alt=66.0 vAcc=100.0 vel=0.34397572 sAcc=20.0 bear=21.440268 bAcc=10.0 {Bundle[{}]}], time: 1694858493508 09-16 15:31:33.890 INFO [TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 09-16 15:31:33.891 DEBUG [TSLocationManager a] Median accuracy: 5.0 09-16 15:31:33.892 DEBUG [TSLocationManager c] Odometer: 14376.768 09-16 15:31:33.909 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 22.3039484,70.8199256 hAcc=5.0) 09-16 15:31:33.912 INFO [SQLiteLocationDAO persist] ✅ INSERT: b0433705-44b5-49d9-8bf0-b11cf02d7df7 09-16 15:31:33.928 INFO [HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 3) ╠═════════════════════════════════════════════ 09-16 15:31:33.943 DEBUG [AbstractService a] 🎾 START [TrackingService startId: 261, eventCount: 1] 09-16 15:31:33.944 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 09-16 15:31:33.949 DEBUG [AbstractService a] ⚙️︎ FINISH [TrackingService startId: 261, eventCount: 0, sticky: false] 09-16 15:31:34.030 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 144 09-16 15:31:34.036 DEBUG [SQLiteLocationDAO allWithLocking] ✅ Locked 3 records 09-16 15:31:34.039 INFO [HttpService a] 🔵 HTTP POST batch (3) 09-16 15:31:34.161 DEBUG [AbstractService f] ⚙️︎ TrackingService.stopSelfResult(261): true 09-16 15:31:34.162 DEBUG [AbstractService onDestroy] 🔴 TrackingService stopped 09-16 15:31:35.959 INFO [HttpService$f onResponse] 🔵 Response: 200 09-16 15:31:35.966 DEBUG [SQLiteLocationDAO destroyAll] ✅ DELETED: (3) 09-16 15:31:35.978 DEBUG [SQLiteLocationDAO allWithLocking] ✅ Locked 0 records 09-16 15:31:35.979 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 144 09-16 15:36:38.447 DEBUG [AbstractService a] 🎾 START [GeofencingService startId: 1, eventCount: 1] 09-16 15:36:38.451 DEBUG [TSConfig e] ℹ️ Persist config, dirty: [isMoving] 09-16 15:36:38.453 INFO [HeartbeatService stop] 🔴 Stop heartbeat 09-16 15:36:38.459 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 🔴 Stop monitoring stationary region 09-16 15:36:38.467 INFO [TrackingService changePace] 🔵 setPace: false → true 09-16 15:36:38.467 INFO [GeofencingService b] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.319421,70.839230 hAcc=72.9 et=+83d20h51m43s437ms alt=85.30000305175781 vAcc=5.4117074] 09-16 15:36:38.468 DEBUG [AbstractService a] ⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false] 09-16 15:36:38.479 DEBUG [AbstractService a] 🎾 START [TrackingService startId: 1, eventCount: 1] 09-16 15:36:38.480 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: true ╠═════════════════════════════════════════════
Screenshot 2023-09-18 at 10 30 13 AM

background-geolocation.log

christocracy commented 1 year ago

At 15:31, the device was detected to have stopped moving:

09-16 15:31:33.944 INFO [TrackingService k]
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════

At 15:38, the OS informed the plugin that the device exited the "stationary geofence" place around the device, had been exited and the plugin resumed tracking.

There is nothing unusual about this, other than taking a longer distance than you wish for. The plugin has no control over when the OS evaluates the "stationary geofence" exit. This is completely up to the OS. It did, in fact, work.

09-16 15:36:38.467 INFO [TrackingService changePace]
🔵 setPace: false → true
09-16 15:36:38.467 INFO [GeofencingService b]
╔═════════════════════════════════════════════
║ GeofencingService: Stationary geofence EXIT
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 22.319421,70.839230 hAcc=72.9 et=+83d20h51m43s437ms alt=85.30000305175781 vAcc=5.4117074]
christocracy commented 1 year ago

and please stop posting long streams of logs into the issue, it's annoying to scroll through. Use the Github <details> tag

Click here to reveal extra content At 15:31, the device was detected to have stopped moving: 09-16 15:31:33.944 INFO [TrackingService k] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ At 15:38, the OS informed the plugin that the device exited the "stationary geofence" place around the device, had been exited and the plugin resumed tracking. There is nothing unusual about this, other than taking a longer distance than you wish for. The plugin has no control over when the OS evaluates the "stationary geofence" exit. This is completely up to the OS. It did, in fact, work. 09-16 15:36:38.467 INFO [TrackingService changePace] 🔵 setPace: false → true 09-16 15:36:38.467 INFO [GeofencingService b] ╔═════════════════════════════════════════════ ║ GeofencingService: Stationary geofence EXIT ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.319421,70.839230 hAcc=72.9 et=+83d20h51m43s437ms alt=85.30000305175781 vAcc=5.4117074]
samp84531 commented 1 year ago

@christocracy Any other way to fix this issue? This issue messes up my tracking.

christocracy commented 1 year ago

stopTimeout: 5,

Increasing your stopTimeout will increase the time it takes to enter the stationary-state.

Once in the stationary-state, the plugin has no control over when the OS informs the plugin when the device is moving (either through Motion API or exiting the "stationary geofence". Certain device manufacturers prevent those APIs from operating promptly in a desire to increase battery life at the expense of proper functionality as documented in the Android API docs.

My Pixel 6 running on Android 14 beta, operating exactly as documented, requires no more than 200 meters of movement before tracking engages. This is how Android is designed to work. What some particular device manufacturer chooses to do is not under any software control

Screenshot 2023-09-18 at 9 06 19 AM
samp84531 commented 1 year ago

@christocracy OK thanks, I will check

christocracy commented 1 year ago

Here is my bus-trip to shopping mall yesterday on Pixel 6. I always use stopTimeout: 1 because I want the plugin to enter stationary-state quickly in order to test jumping to moving state.

Screenshot 2023-09-18 at 9 11 48 AM
samp84531 commented 1 year ago

I'm a little confused, how do you draw the green line based on location or what?

christocracy commented 1 year ago

That is the “jump” from the stationary state (small red circle) -> moving state. The location is unknown between those two points.

the plug-in typically requires movement of at least 200 meters before motion is recognized when location-services are turned on and the plug-in resumes tracking.

read the wiki “Philosophy of Operation”.

christocracy commented 1 year ago

The plug-in uses the onMotionChange event to draw that green polyline, connecting the last known location (red circle) to the current location when location-services were turned on.

samp84531 commented 1 year ago

got it, @christocracy thank you!