transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

After recent plugin upgradation, BG Geolocation actual tracking takes time to start #1369

Closed tushaagit closed 2 weeks ago

tushaagit commented 1 year ago

BG Geolocation actual tracking takes time to start


Your Environment

bgGeo.setConfig({ url: window.app.config.serviceServicePath + 'RecordUserGeoLocation', params: { "EmployeeID": empID, "UserID": userID, "UserName": userName, "Remarks": "Transistorsoft Recording", "AttendanceID": localStorage.getItem("AttendanceID"), } }


## Expected Behavior
 BG Geolocation actual tracking should start as soon as bg service is started 

## Actual Behavior
 Since latest version plugin is installed, BG Geolocation actual tracking takes time to start even if bg service is started, location uploading to server takes time. Same behavior is observed when device is still for a moment in between the travel route, location updation stops for a while and when again travel is continued, though BG geolocation service is already in started mode, it takes time to start engaging/uploading locations to server. 
Note: This issue is consistent across all android mobile device/models. please observe the data from BGeo Service start  Till the actual point plotting started i.e around 10:18 am to server using external link passed to config 

## Steps to Reproduce

1. Start the location service BGGeo.Start, 
2. Start the movement say on bike/car, Location uploading starts lately after say 5 minutes/ 1-2 kms. (so in between coordinates and odometer distance is skipped)
3. Now just stop the vehicle for few minutes, either can do some activity in device/app OR can keep it untouched. then again start the travel after few minutes 
4. New Locations are taking time to upload say after 5/10 minutes OR 2-3 kms, in between data is not captured

## Context
We found that many devices gave issues in tracking on regular basis even though, all the necessary conditions like gps ON, location always allow, stopOnTerminate: false, etc., are satisfied.

## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat
-->
<details>
    <summary>Logs</summary>

```<!-- Syntax highlighting:  DO NOT REMOVE -->

10-12 09:34:46.917 DEBUG [LoggerFacade$a a] ℹ️   Persist config, dirty: []
10-12 09:34:46.979 DEBUG [a onCreate] CREATE TABLE IF NOT EXISTS locations (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT NOT NULL DEFAULT '', timestamp TEXT, json TEXT, data BLOB, encrypted BOOLEAN NOT NULL DEFAULT 0, locked BOOLEAN NOT NULL DEFAULT 0);
10-12 09:34:46.980 DEBUG [a onCreate] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay INTEGER NOT NULL DEFAULT 0, extras TEXT);
10-12 09:34:46.983 DEBUG [b prune] 
  ℹ️  PRUNE -1 days
10-12 09:34:47.871 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 09:34:49.526 INFO [TSProviderManager handleProviderChangeEvent] 
╔═════════════════════════════════════════════
║ Location-provider change: true
╠═════════════════════════════════════════════
╟─ GPS: true
╟─ Network: true
╟─ AP Mode: false

10-12 09:34:51.545 DEBUG [LifecycleManager onResume] ☯️  onResume
10-12 09:35:09.400 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 09:35:09.402 DEBUG [LifecycleManager onStop] ☯️  onStop
10-12 10:13:21.383 INFO [LoggerFacade$a a] 
╔═════════════════════════════════════════════
║ TSLocationManager version: 3.2.1 (407)
╠═════════════════════════════════════════════
╟─ Xiaomi M2010J19CI @ 11 (cordova)
{
  "activityRecognitionInterval": 10000,
  "allowIdenticalLocations": false,
  "authorization": {},
  "autoSync": true,
  "autoSyncThreshold": 0,
  "backgroundPermissionRationale": {
    "title": "Allow {applicationName} to access to this device's location in the background?",
    "message": "In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission",
    "positiveAction": "Change to {backgroundPermissionOptionLabel}",
    "negativeAction": "Cancel"
  },
  "batchSync": false,
  "configUrl": "",
  "debug": false,
  "deferTime": 0,
  "desiredAccuracy": -1,
  "desiredOdometerAccuracy": 250,
  "disableAutoSyncOnCellular": false,
  "disableElasticity": true,
  "disableLocationAuthorizationAlert": false,
  "disableMotionActivityUpdates": false,
  "disableStopDetection": false,
  "distanceFilter": 50,
  "elasticityMultiplier": 1,
  "enableHeadless": true,
  "enableTimestampMeta": false,
  "extras": {},
  "fastestLocationUpdateInterval": -1,
  "foregroundService": true,
  "geofenceInitialTriggerEntry": true,
  "geofenceModeHighAccuracy": false,
  "geofenceProximityRadius": 1000,
  "geofenceTemplate": "",
  "headers": {},
  "headlessJobService": "com.transistorsoft.cordova.bggeo.BackgroundGeolocationHeadlessTask",
  "heartbeatInterval": -1,
  "httpRootProperty": "location",
  "httpTimeout": 60000,
  "isMoving": false,
  "locationAuthorizationRequest": "Always",
  "locationTemplate": "",
  "locationTimeout": 60,
  "locationUpdateInterval": 1000,
  "locationsOrderDirection": "ASC",
  "logLevel": 5,
  "logMaxDays": 3,
  "maxBatchSize": -1,
  "maxDaysToPersist": 1,
  "maxRecordsToPersist": -1,
  "method": "POST",
  "minimumActivityRecognitionConfidence": 75,
  "motionTriggerDelay": 0,
  "notification": {
    "layout": "",
    "title": "",
    "text": "Location Service activated",
    "color": "",
    "channelName": "TSLocationManager",
    "smallIcon": "",
    "largeIcon": "",
    "priority": -2,
    "sticky": false,
    "strings": {},
    "actions": []
  },
  "params": {},
  "persist": true,
  "persistMode": 1,
  "schedule": [],
  "scheduleUseAlarmManager": false,
  "speedJumpFilter": 300,
  "startOnBoot": false,
  "stationaryRadius": 25,
  "stopAfterElapsedMinutes": 0,
  "stopOnStationary": false,
  "stopOnTerminate": false,
  "stopTimeout": 5,
  "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
  "url": "",
  "useSignificantChangesOnly": false,
  "enabled": false,
  "schedulerEnabled": false,
  "trackingMode": 1,
  "odometer": 0,
  "isFirstBoot": false,
  "didLaunchInBackground": false,
  "didDeviceReboot": false
}
10-12 10:13:21.386 INFO [LoggerFacade$a a] 
╔═════════════════════════════════════════════
║ DEVICE SENSORS
╠═════════════════════════════════════════════
╟─ ✅  ACCELEROMETER: {Sensor name="sc7a20 Accelerometer Non-wakeup", vendor="SLCompany", version=742, type=1, maxRange=78.45198, resolution=0.03824594, power=0.011, minDelay=2500}
╟─ ✅  GYROSCOPE: {Sensor name="gyro Gyroscope Non-wakeup", vendor="Voltafield", version=261, type=4, maxRange=38.396004, resolution=0.0026179168, power=0.02, minDelay=10000}
╟─ ✅  MAGNETOMETER: {Sensor name="mmc56x3x Magnetometer Non-wakeup", vendor="memsic", version=20120408, type=2, maxRange=3000.0044, resolution=0.0976, power=1.0, minDelay=10000}
╟─ ✅  SIGNIFICANT_MOTION: {Sensor name="sns_smd  Wakeup", vendor="qualcomm", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.025, minDelay=-1}
╚═════════════════════════════════════════════
10-12 10:13:21.386 INFO [LoggerFacade$a a] 
  ✅  Google Play Services: connected (version code:12451000)
10-12 10:13:21.387 DEBUG [LoggerFacade$a a] ☯️  onCreate
10-12 10:13:21.387 DEBUG [LoggerFacade$a a] ☯️  onStart
10-12 10:13:21.388 DEBUG [LoggerFacade$a a] ☯️  onResume
10-12 10:13:21.417 INFO [TSProviderManager startMonitoring] 
  🎾  Start monitoring location-provider changes
10-12 10:13:21.446 DEBUG [b prune] 
  ℹ️  PRUNE -1 days
10-12 10:13:21.459 DEBUG [TSConfig d] ℹ️   Persist config, dirty: [backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, desiredAccuracy, desiredOdometerAccuracy, disableElasticity, distanceFilter, enableHeadless, extras, headers, headlessJobService, logLevel, notification, notification.priority, params, persistMode, schedule, stopOnTerminate]
10-12 10:13:21.473 DEBUG [TSConfig d] ℹ️   Persist config, dirty: [backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, desiredAccuracy, desiredOdometerAccuracy, disableElasticity, distanceFilter, enableHeadless, headlessJobService, logLevel, notification, notification.priority, persistMode, stopOnTerminate]
10-12 10:13:33.652 INFO [c h] 
  🔵  LocationAuthorization: Requesting permission
10-12 10:13:33.683 DEBUG [TSConfig d] ℹ️   Persist config, dirty: [params, url]
10-12 10:13:33.724 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════

10-12 10:13:33.748 INFO [c g] 
  🔵  LocationAuthorization: Requesting Background permission
10-12 10:13:34.678 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 10:13:35.455 INFO [c$j onPermissionGranted] 
  ✅  LocationAuthorization: Permission granted
10-12 10:13:35.580 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:35.582 INFO [SingleLocationRequest startUpdatingLocation] 
  🔵  [SingleLocationRequest start, action: 2, requestId: 1]
10-12 10:13:35.585 INFO [c e] 
  🔵  Should show backgroundPermissionRationale? true
10-12 10:13:35.588 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:35.598 DEBUG [LifecycleManager onResume] ☯️  onResume
10-12 10:13:35.919 DEBUG [TSLocationManagerActivity execute] android.permission.ACCESS_BACKGROUND_LOCATION
10-12 10:13:37.062 DEBUG [TSLocationManagerActivity stop] eventCount: 0
10-12 10:13:37.237 DEBUG [TSLocationManagerActivity onDestroy] 
10-12 10:13:38.096 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 10:13:38.531 DEBUG [LifecycleManager onStop] ☯️  onStop
10-12 10:13:38.685 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:38.696 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ getCurrentPosition LocationResult: 1
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643335,73.775170 hAcc=88 et=+7d23h36m7s694ms alt=513.7000122070312 vAcc=15 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2868ms, time: 1665549815824

10-12 10:13:38.707 INFO [TSLocationManager onSingleLocationResult] 
  🔵  Acquired current position
10-12 10:13:38.709 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 87.6
10-12 10:13:38.726 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:38.752 DEBUG [AbstractService onDestroy] 
  🔴  LocationRequestService stopped
10-12 10:13:38.852 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 1 isFinished? true
10-12 10:13:38.854 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:39.353 DEBUG [LifecycleManager onStart] ☯️  onStart
10-12 10:13:39.506 INFO [c$j onPermissionGranted] 
  ✅  LocationAuthorization: Permission granted
10-12 10:13:39.538 DEBUG [HttpService startMonitoringConnectivityChanges] 
  🎾  Start monitoring connectivity changes
10-12 10:13:39.555 DEBUG [DeviceSettings startMonitoringPowerSaveChanges] 
  🎾  Start monitoring powersave changes
10-12 10:13:39.576 DEBUG [LifecycleManager onResume] ☯️  onResume
10-12 10:13:39.583 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════

10-12 10:13:39.594 INFO [HeartbeatService stop] 
  🔴  Stop heartbeat
10-12 10:13:39.626 INFO [HeartbeatService stop] 
  🔴  Stop heartbeat
10-12 10:13:39.626 DEBUG [c h] 
  ℹ️  LocationAuthorization: Permission granted
10-12 10:13:39.628 INFO [TrackingService changePace] 
  🔵  setPace: false → false
10-12 10:13:39.646 DEBUG [c h] 
  ℹ️  LocationAuthorization: Permission granted
10-12 10:13:39.648 INFO [TrackingService changePace] 
  🔵  setPace: false → false
10-12 10:13:39.661 DEBUG [c h] 
  ℹ️  LocationAuthorization: Permission granted
10-12 10:13:39.667 INFO [TSProviderManager handleProviderChangeEvent] 
╔═════════════════════════════════════════════
║ Location-provider change: true
╠═════════════════════════════════════════════
╟─ GPS: true
╟─ Network: true
╟─ AP Mode: false

10-12 10:13:39.673 DEBUG [HttpService a] 
╔═════════════════════════════════════════════
║ 📶  Connectivity change: connected? true
╠═════════════════════════════════════════════

10-12 10:13:39.732 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:39.735 ERROR [LocationRequestService handleStartAction] 
  ‼️  Failed to find SingleLocationRequest in START action; requestId: 2; Intent: Intent { act=start cmp=com.erpbynet.smarttechnician/com.transistorsoft.locationmanager.service.LocationRequestService (has extras) }
10-12 10:13:39.737 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:39.739 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:39.753 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 0]
10-12 10:13:39.755 INFO [SingleLocationRequest startUpdatingLocation] 
  🔵  [SingleLocationRequest start, action: 1, requestId: 3]
10-12 10:13:39.764 WARN [ActivityRecognitionService start] 
  ⚠️  Cannot start motion-activity updates:  permission is denied
10-12 10:13:39.769 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:39.772 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 0]
10-12 10:13:39.774 INFO [SingleLocationRequest startUpdatingLocation] 
  🔵  [SingleLocationRequest start, action: 3, requestId: 4]
10-12 10:13:39.777 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:39.934 DEBUG [TSLocationManagerActivity execute] locationsettings
10-12 10:13:39.936 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
10-12 10:13:39.998 DEBUG [TSLocationManagerActivity execute] locationsettings
10-12 10:13:39.999 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
10-12 10:13:40.004 DEBUG [TSLocationManagerActivity stop] eventCount: 1
10-12 10:13:40.076 DEBUG [TSLocationManagerActivity stop] eventCount: 0
10-12 10:13:40.150 DEBUG [AbstractService onDestroy] 
  🔴  LocationRequestService stopped
10-12 10:13:40.221 DEBUG [TSLocationManagerActivity onDestroy] 
10-12 10:13:40.676 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════

10-12 10:13:41.830 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:41.837 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ motionchange LocationResult: 3
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643404,73.775194 hAcc=72 et=+7d23h36m10s900ms alt=513.7000122070312 vel=0.082184345 bear=17.6286 vAcc=7 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2803ms, time: 1665549819031

10-12 10:13:41.838 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 79.725
10-12 10:13:41.845 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 2]
10-12 10:13:41.853 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ providerchange LocationResult: 4
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643404,73.775194 hAcc=72 et=+7d23h36m10s900ms alt=513.7000122070312 vel=0.082184345 bear=17.6286 vAcc=7 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2818ms, time: 1665549819031

10-12 10:13:41.864 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 71.85
10-12 10:13:41.864 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 3 isFinished? false
10-12 10:13:41.865 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 1, sticky: true]
10-12 10:13:41.878 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 4 isFinished? false
10-12 10:13:41.880 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:45.995 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
10-12 10:13:46.389 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 10:13:46.390 DEBUG [LifecycleManager onStop] ☯️  onStop
10-12 10:13:46.478 DEBUG [LifecycleManager onStart] ☯️  onStart
10-12 10:13:46.607 DEBUG [LifecycleManager onResume] ☯️  onResume
10-12 10:13:46.615 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 0)
╠═════════════════════════════════════════════

10-12 10:13:46.935 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:46.942 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ motionchange LocationResult: 3
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643410,73.775196 hAcc=132 et=+7d23h36m16s761ms alt=513.7000122070312 vel=0.09809183 bear=17.6286 vAcc=7 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2047ms, time: 1665549824892

10-12 10:13:46.944 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 79.725
10-12 10:13:46.969 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 3 isFinished? false
10-12 10:13:46.970 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:47.004 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:47.009 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ providerchange LocationResult: 4
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643410,73.775196 hAcc=132 et=+7d23h36m16s761ms alt=513.7000122070312 vel=0.09809183 bear=17.6286 vAcc=7 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2115ms, time: 1665549824892

10-12 10:13:47.010 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 87.6
10-12 10:13:47.031 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 4 isFinished? false
10-12 10:13:47.031 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:13:48.054 INFO [TSScheduleManager oneShot] 
  ⏰ Oneshot TERMINATE_EVENT is already pending
10-12 10:13:48.066 DEBUG [LifecycleManager onPause] ☯️  onPause
10-12 10:13:48.067 DEBUG [LifecycleManager onStop] ☯️  onStop
10-12 10:13:48.343 INFO [TSScheduleManager cancelOneShot] 
  ⏰ Cancel OneShot: TERMINATE_EVENT
10-12 10:13:48.375 DEBUG [LifecycleManager a] 
╔═════════════════════════════════════════════
║ ☯️  HeadlessMode? true
╠═════════════════════════════════════════════

10-12 10:13:48.385 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: terminate<><>terminate
10-12 10:13:48.387 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{},"autoSync":true,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow {applicationName} to access to this device's location in the background?","message":"In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission","positiveAction":"Change to {backgroundPermissionOptionLabel}","negativeAction":"Cancel"},"batchSync":false,"configUrl":"","debug":false,"deferTime":0,"desiredAccuracy":-1,"desiredOdometerAccuracy":250,"disableAutoSyncOnCellular":false,"disableElasticity":true,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableStopDetection":false,"distanceFilter":50,"elasticityMultiplier":1,"enableHeadless":true,"enableTimestampMeta":false,"extras":{},"fastestLocationUpdateInterval":-1,"foregroundService":true,"geofenceInitialTriggerEntry":true,"geofenceModeHighAccuracy":false,"geofenceProximityRadius":1000,"geofenceTemplate":"","headers":{},"headlessJobService":"com.transistorsoft.cordova.bggeo.BackgroundGeolocationHeadlessTask","heartbeatInterval":-1,"httpRootProperty":"location","httpTimeout":60000,"isMoving":false,"locationAuthorizationRequest":"Always","locationTemplate":"","locationTimeout":60,"locationUpdateInterval":1000,"locationsOrderDirection":"ASC","logLevel":5,"logMaxDays":3,"maxBatchSize":-1,"maxDaysToPersist":1,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":0,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","smallIcon":"","largeIcon":"","priority":-2,"sticky":false,"strings":{},"actions":[]},"params":{"EmployeeID":"722","UserID":"698","UserName":"Tushara","Remarks":"Transistorsoft Recording","AttendanceID":"5245"},"persist":true,"persistMode":1,"schedule":[],"scheduleUseAlarmManager":false,"speedJumpFilter":300,"startOnBoot":false,"stationaryRadius":25,"stopAfterElapsedMinutes":0,"stopOnStationary":false,"stopOnTerminate":false,"stopTimeout":5,"triggerActivities":"in_vehicle, on_bicycle, on_foot, running, walking","url":"http:\/\/api.ServiceDev.xecomit.com\/api\/RecordUserGeoLocation","useSignificantChangesOnly":false,"enabled":true,"schedulerEnabled":false,"trackingMode":1,"odometer":0,"isFirstBoot":false,"didLaunchInBackground":false,"didDeviceReboot":false}
10-12 10:13:48.388 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask]  $$$$$: Xecommmmmmmmmmm 
10-12 10:13:48.390 DEBUG [BackgroundGeolocation b] 
  🔴  Cleared callbacks
10-12 10:13:48.392 INFO [BackgroundGeolocation$l0 run] 
╔═════════════════════════════════════════════
║ MainActivity was destroyed
╠═════════════════════════════════════════════
╟─ stopOnTerminate: false
╟─ enabled: true

10-12 10:13:52.864 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:13:52.872 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ motionchange LocationResult: 3
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643419,73.775194 hAcc=78 et=+7d23h36m21s823ms alt=513.7000122070312 vel=0.122508936 bear=2.4278593 vAcc=6 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2913ms, time: 1665549829954

10-12 10:13:52.880 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 2]
10-12 10:13:52.882 INFO [TSLocationManager onSingleLocationResult] 
  🔵  Acquired motionchange position, isMoving: false
10-12 10:13:52.883 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ providerchange LocationResult: 4
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.643419,73.775194 hAcc=78 et=+7d23h36m21s823ms alt=513.7000122070312 vel=0.122508936 bear=2.4278593 vAcc=6 sAcc=??? bAcc=??? {Bundle[{}]}], age: 2927ms, time: 1665549829954

10-12 10:13:52.891 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 3 isFinished? true
10-12 10:13:52.892 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 1, sticky: false]
10-12 10:13:52.893 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:52.898 INFO [TSLocationManager onSingleLocationResult] 
  🔵  Acquired providerchange position
10-12 10:13:52.906 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 4 isFinished? true
10-12 10:13:52.907 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:52.912 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:13:52.912 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@f692420
10-12 10:13:52.914 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: motionchange<><>terminate
10-12 10:13:52.914 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.event.MotionChangeEvent@98651d9
10-12 10:13:52.915 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:13:52.916 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@1f7279e
10-12 10:13:52.918 INFO [b persist] 
  ✅  INSERT: 8f37be3b-c8c1-463e-b3f2-384f8342568e
10-12 10:13:52.919 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 
  🎾  Start monitoring stationary region (radius: 150.0m 18.6434044,73.7751936 hAcc=71.85)
10-12 10:13:52.927 INFO [b persist] 
  ✅  INSERT: d4e95ebb-6226-46c8-9ab9-d0785132a43a
10-12 10:13:52.935 INFO [HttpService flush] 
  ℹ️  HttpService is busy
10-12 10:13:52.936 INFO [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service (count: 2)
╠═════════════════════════════════════════════

10-12 10:13:52.946 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:13:52.948 DEBUG [TSLocationManager$b onLocation] 
  ℹ️  Distance from last location: 167.57147
10-12 10:13:52.949 DEBUG [AbstractService onDestroy] 
  🔴  LocationRequestService stopped
10-12 10:13:52.986 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:13:52.990 INFO [TrackingService handleMotionChangeResult] 
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════

10-12 10:13:53.001 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: false]
10-12 10:13:53.024 DEBUG [AbstractService start] 
  🎾  BackgroundTaskService [eventCount: 1]
10-12 10:13:53.025 INFO [BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 1
10-12 10:13:53.039 DEBUG [b first] 
  ✅  Locked 1 records
10-12 10:13:53.040 INFO [HttpService a] 
  🔵  HTTP POST: 8f37be3b-c8c1-463e-b3f2-384f8342568e
10-12 10:13:53.253 INFO [HttpService$h onResponse] 
  🔵  Response: 200
10-12 10:13:53.254 DEBUG [AbstractService onDestroy] 
  🔴  TrackingService stopped
10-12 10:13:53.257 DEBUG [b destroy] 
  ✅  DESTROY: 8f37be3b-c8c1-463e-b3f2-384f8342568e
10-12 10:13:53.257 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: http<><>terminate
10-12 10:13:53.257 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.http.HttpResponse@b94eb05
10-12 10:13:53.267 DEBUG [b first] 
  ✅  Locked 1 records
10-12 10:13:53.268 INFO [HttpService a] 
  🔵  HTTP POST: d4e95ebb-6226-46c8-9ab9-d0785132a43a
10-12 10:13:53.347 INFO [HttpService$h onResponse] 
  🔵  Response: 200
10-12 10:13:53.349 DEBUG [b destroy] 
  ✅  DESTROY: d4e95ebb-6226-46c8-9ab9-d0785132a43a
10-12 10:13:53.349 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: http<><>terminate
10-12 10:13:53.349 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.http.HttpResponse@c7b7d8b
10-12 10:13:53.359 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 1
10-12 10:13:53.359 DEBUG [AbstractService finish] ⚙️︎  finish BackgroundTaskService [eventCount: 0, sticky: false]
10-12 10:13:53.374 DEBUG [AbstractService onDestroy] 
  🔴  BackgroundTaskService stopped
10-12 10:18:35.252 DEBUG [AbstractService start] 
  🎾  GeofencingService [eventCount: 1]
10-12 10:18:35.261 DEBUG [TSConfig d] ℹ️   Persist config, dirty: [isMoving]
10-12 10:18:35.265 INFO [HeartbeatService stop] 
  🔴  Stop heartbeat
10-12 10:18:35.268 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion] 
  🔴  Stop monitoring stationary region
10-12 10:18:35.278 DEBUG [c h] 
  ℹ️  LocationAuthorization: Permission granted
10-12 10:18:35.278 INFO [TrackingService changePace] 
  🔵  setPace: false → true
10-12 10:18:35.287 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:18:35.288 INFO [TrackingService handleMotionChangeResult] 
╔═════════════════════════════════════════════
║ TrackingService motionchange: true
╠═════════════════════════════════════════════

10-12 10:18:35.289 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: true]
10-12 10:18:35.291 INFO [GeofencingService handleStationaryGeofenceExit] 
╔═════════════════════════════════════════════
║ GeofencingService: Stationary geofence EXIT
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.629553,73.775103 hAcc=7 et=+7d23h41m6s884ms alt=513.7000122070312 vel=6.85 bear=161.0 vAcc=6 sAcc=1 bAcc=4]

10-12 10:18:35.291 DEBUG [AbstractService finish] ⚙️︎  finish GeofencingService [eventCount: 0, sticky: false]
10-12 10:18:35.311 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:18:35.313 INFO [SingleLocationRequest startUpdatingLocation] 
  🔵  [SingleLocationRequest start, action: 1, requestId: 5]
10-12 10:18:35.318 WARN [ActivityRecognitionService start] 
  ⚠️  Cannot start motion-activity updates:  permission is denied
10-12 10:18:35.320 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: true]
10-12 10:18:35.795 DEBUG [AbstractService onDestroy] 
  🔴  GeofencingService stopped
10-12 10:18:36.558 DEBUG [AbstractService start] 
  🎾  LocationRequestService [eventCount: 1]
10-12 10:18:36.572 INFO [LocationRequestService handleLocationResult] 
╔═════════════════════════════════════════════
║ motionchange LocationResult: 5
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.629455,73.775123 hAcc=6 et=+7d23h41m8s296ms alt=513.7000122070312 vel=6.643788 bear=160.01491 vAcc=6 sAcc=1 bAcc=4 {Bundle[{}]}], age: 135ms, time: 1665550116054

10-12 10:18:36.589 INFO [TSLocationManager onSingleLocationResult] 
  🔵  Acquired motionchange position, isMoving: true
10-12 10:18:36.591 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 79.725
10-12 10:18:36.595 DEBUG [TSLocationManager incrementOdometer] Odometer: 1544.0789
10-12 10:18:36.597 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:18:36.621 DEBUG [AbstractService onDestroy] 
  🔴  LocationRequestService stopped
10-12 10:18:36.643 INFO [TSLocationManager requestLocationUpdates] 
  🎾  Location-services: ON
10-12 10:18:36.645 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
10-12 10:18:36.645 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:18:36.645 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@2fdf857
10-12 10:18:36.646 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: motionchange<><>terminate
10-12 10:18:36.647 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.event.MotionChangeEvent@2176f44
10-12 10:18:36.651 DEBUG [LocationRequestService handleLocationResult] SingleLocationRequest 5 isFinished? true
10-12 10:18:36.652 WARN [ActivityRecognitionService start] 
  ⚠️  Cannot start motion-activity updates:  permission is denied
10-12 10:18:36.656 DEBUG [AbstractService finish] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
10-12 10:18:36.657 INFO [b persist] 
  ✅  INSERT: 0c23adcc-c784-498a-be39-90d20645b210
10-12 10:18:36.724 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:18:36.729 DEBUG [TrackingService handleLocationResult] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.629455,73.775123 hAcc=6 et=+7d23h41m8s296ms alt=513.7000122070312 vel=6.643788 bear=160.01491 vAcc=6 sAcc=1 bAcc=4 {Bundle[{}]}]
╟─ Age: 298ms, time: 1665550116054

10-12 10:18:36.730 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: true]
10-12 10:18:36.730 DEBUG [TSLocationManager onLocationResult] 
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════

10-12 10:18:36.731 DEBUG [TSLocationManager onLocationResult] 
  ℹ️  IGNORED: same as last location
10-12 10:18:46.981 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:18:46.987 DEBUG [TrackingService handleLocationResult] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.629022,73.775338 hAcc=4 et=+7d23h41m18s738ms alt=513.7000122070312 vel=4.5863876 bear=140.9417 vAcc=6 sAcc=1 bAcc=14 {Bundle[{}]}]
╟─ Age: 114ms, time: 1665550127000

10-12 10:18:46.989 DEBUG [TSLocationManager onLocationResult] 
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════

10-12 10:18:46.989 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 53.022793, apparent speed: 5.077839
10-12 10:18:46.990 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 71.85
10-12 10:18:46.991 DEBUG [TSLocationManager incrementOdometer] Odometer: 1597.1017
10-12 10:18:47.002 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 70442ms (jobID: -18513055)
10-12 10:18:47.015 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: true]
10-12 10:18:47.020 INFO [b persist] 
  ✅  INSERT: a64654a2-b1bb-4c71-8c8a-f0a81ee5e987
10-12 10:18:47.024 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:18:47.025 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@a4f3a29
10-12 10:18:56.907 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:18:56.914 DEBUG [TrackingService handleLocationResult] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.628521,73.775362 hAcc=4 et=+7d23h41m28s735ms alt=513.7000122070312 vel=9.376116 bear=173.00195 vAcc=6 sAcc=0 bAcc=1 {Bundle[{}]}]
╟─ Age: 44ms, time: 1665550137000

10-12 10:18:56.915 DEBUG [TSLocationManager onLocationResult] 
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════

10-12 10:18:56.916 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 55.42101, apparent speed: 5.543764
10-12 10:18:56.916 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 71.85
10-12 10:18:56.917 INFO [TSScheduleManager cancelOneShot] 
  ⏰ Cancel OneShot: MOTION_ACTIVITY_CHECK
10-12 10:18:56.917 DEBUG [TSLocationManager incrementOdometer] Odometer: 1652.5227
10-12 10:18:56.925 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 69997ms (jobID: -18513055)
10-12 10:18:56.928 INFO [b persist] 
  ✅  INSERT: 4c720143-a599-4b0d-98c0-cf341cb53240
10-12 10:18:56.928 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: true]
10-12 10:18:56.934 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:18:56.934 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@e784fe5
10-12 10:19:02.940 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:19:02.945 DEBUG [TrackingService handleLocationResult] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.628016,73.775452 hAcc=4 et=+7d23h41m34s747ms alt=513.7000122070312 vel=10.054186 bear=168.0243 vAcc=7 sAcc=1 bAcc=1 {Bundle[{}]}]
╟─ Age: 64ms, time: 1665550143000

10-12 10:19:02.947 DEBUG [TSLocationManager onLocationResult] 
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════

10-12 10:19:02.948 INFO [TSScheduleManager cancelOneShot] 
  ⏰ Cancel OneShot: MOTION_ACTIVITY_CHECK
10-12 10:19:02.948 DEBUG [TSLocationManager locationIsInvalid] Distance from last location: 56.77977, apparent speed: 9.445977
10-12 10:19:02.950 DEBUG [TSLocationManager calculateMedianAccuracy] Median accuracy: 71.85
10-12 10:19:02.952 DEBUG [TSLocationManager incrementOdometer] Odometer: 1709.3025
10-12 10:19:02.954 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: MOTION_ACTIVITY_CHECK in 66011ms (jobID: -18513055)
10-12 10:19:02.957 DEBUG [AbstractService finish] ⚙️︎  finish TrackingService [eventCount: 0, sticky: true]
10-12 10:19:02.964 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] 💀  event: location<><>terminate
10-12 10:19:02.964 DEBUG [BackgroundGeolocationHeadlessTask onHeadlessTask] ---> event: com.transistorsoft.locationmanager.location.TSLocation@f91d0c8
10-12 10:19:02.970 INFO [b persist] 
  ✅  INSERT: d84fb9fa-10c5-44a6-afc8-fe5989797897
10-12 10:19:08.932 DEBUG [AbstractService start] 
  🎾  TrackingService [eventCount: 1]
10-12 10:19:08.935 DEBUG [TrackingService handleLocationResult] 
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍  Location[fused 18.627529,73.775542 hAcc=4 et=+7d23h41m40s751ms alt=513.7000122070312 vel=5.5079074 bear=169.00697 vAcc=7 sAcc=0 bAcc=2 {Bundle[{}]}]
╟─ Age: 51ms, time: 1665550149000

christocracy commented 1 year ago

⚠️ Cannot start motion-activity updates: permission is denied

Motion api requires runtime permission from the user. In the logs you’ve shown, the user did not authorize “Health and Fitness” permission.

therefore, the only way the plugin can detect the device is moving is via exiting a geofence around the last known position, requiring movement of at least 200 meters before tracking engages.

tushaagit commented 1 year ago

Thanks for such a quick response Sir, Just want to clear one thing, i haven't came across any health and fitness permission, but if you are referring to Physical activity permission, it was ON (Allow)

christocracy commented 1 year ago

Physical activity permission

Yes, it's that.

it was ON (Allow)

The plugin could not receive permission to start the motion api.

⚠️ Cannot start motion-activity updates: permission is denied

tushaagit commented 1 year ago

But sir what could be the solution for this, physical activity was already allowed while installing the app, and throughout the whole journey, the device was not opened or any permission was not altered afterwards, still it started capturing locations after sometime, what can be done programmatically to get it working from the start as soon as the bg geo location starts.
Attaching the whole log for your reference, background-geolocation_TransistorSoft.log

christocracy commented 1 year ago

what could be the solution for this, physical activity was already allowed while installing the app

Your app does not have physical activity permission. You think it does, but it does not.

Have you recently updated your targetSdkVersion? Have your read about the new runtime permission requirement for Physical Activity introduced in Android 10? The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched.

still it started capturing locations after sometime,

As I said above: "therefore, the only way the plugin can detect the device is moving is via exiting a geofence around the last known position, requiring movement of at least 200 meters before tracking engages."

The plugin uses a geofence as a secondary triggering mechanism.

tushaagit commented 1 year ago

Have you recently updated your targetSdkVersion? - Yes,

The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched. - Yes, it shows the physical activity permission without fail, and we developers always keep it as Allow.

Also it captures the location points correctly as specified in config i.e distanceFilter = 50, only issue comes when device changes its state from still to active, location updates take time to record, but we are sure that being a developer we always try to allow every permission, and physical activity is one of it,

Still i am adding below permission in manifest, lets see if it makes any difference. android.permission.ACTIVITY_RECOGNITION

Thanks Sir

christocracy commented 1 year ago

I told you: "The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched."

You DO NOT need to manually add the permission android.permission.ACTIVITY_RECOGNITION.

Here are all the permissions automatically included into your app by the plugin:

<uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
tushaagit commented 1 year ago

Yes Sir, those permissions come automatically, please check my latest attached log, check specifically between 7:50 pm to 8:45 pm IST, all permissions accepted including physical activity, also confirmed it in app settings before starting the journey, still it took time to record the first location to external link, exactly at 8:05:14 pm it recorded the first location, while background service was started 10-15 mins before, also crossed a distance of nearly 2km, the in between points not available. Also check the travel path highlighted in yellow color for confirmation

image background-geolocation.log.gz

christocracy commented 1 year ago

The plugin has no control over when the Motion API fires an event to show that the device is moving.

The Motion API has nothing more than an ON/OFF switch. It is not configurable. There is no way to increase the sensitivity. It's purely up to the OS to fire these events and depends upon the quality of the device and sensors inside it.

The plugin received the first Motion Transition event here:

10-12 20:05:14.358 INFO [ActivityRecognitionService handleActivityTransitionResult] 
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🎾  ENTER: in_vehicle
╚═════════════════════════════════════════════

When you test on a variety of devices, you'll find better / worse performance.

You can simulate walking by shaking the device vigorously while watch adb logcat *:S TSLocationManager:V and/or configure debug: true so you can hear the plugin enter the moving state.

Also see https://dontkillmyapp.com

tushaagit commented 1 year ago

We are getting same issue almost on every device we checked, have one query sir, considering that devices take time to get engage in location capturing activity for the first time as per the sensitivity, but once the motion activity is recognized, does this service pauses/stops automatically as and when the still event is found? (As this happens frequently during travel, if device remains still for a while) IF yes can we do some setting to keep the device always active by firing change pace true, etc , we know that battery would be consumed, but at least we can keep it optional and keep that setting, if rigorous tracking is required

christocracy commented 1 year ago

does this service pauses/stops automatically as and when the still event is found

See API docs Config.stopTimeout.

christocracy commented 1 year ago

You will get a better idea of what the plugin is doing with debug: true so you can hear what the plugin is doing.

mbachega commented 9 months ago

any progress with this question?

github-actions[bot] commented 1 month ago

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

github-actions[bot] commented 2 weeks ago

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