-
Notifications
You must be signed in to change notification settings - Fork 441
Description
Required Reading
- Confirmed
Plugin Version
4.19.0
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
Samsung Galaxy A13
Device operating-systems(s)
Android 14
React Native / Expo version
0.82.1
What do you require assistance about?
Hi,
In my application, the logic is built in such a way that I need to periodically call start and startGeofences.
In Sentry, I’m seeing a large number of errors with the message:
“Waiting for previous start action to complete”
Both start and startGeofences are guaranteed to be called after ready, however quite often the calls still fail with this error. One important detail is that these methods are sometimes invoked when the app is launched in the background after receiving a push notification.
It’s difficult to provide a minimal piece of production code that reliably reproduces the issue, but I tried to emulate the behavior and ended up with the following example:
(async () => {
await RNBG.ready({
logLevel: RNBG.LOG_LEVEL_DEBUG,
startOnBoot: false,
stopOnTerminate: true,
});
await RNBG.start();
const tryStartGeofences = async () => {
try {
await RNBG.startGeofences();
} catch (error) {
console.error(error);
setTimeout(tryStartGeofences, 1000);
}
};
setTimeout(tryStartGeofences, 1000);
})();In this example, the error does not happen every time — it may require running it a few times.
start always completes successfully, but startGeofences sometimes fails. In my tests, it usually fails on the second or third attempt, producing 1–2 errors with the message “Waiting for previous start action to complete” before startGeofences finally succeeds.
My understanding was that a successful resolution of start should indicate that the corresponding action has fully completed. However, it’s not clear to me which “previous start action” is still being awaited at the moment when startGeofences is called.
Could you please explain why this error occurs in the example above?
And if you have any insights into why these errors happen significantly more often when the app is running or launched in the background, I would really appreciate it.
Thanks in advance.
[Optional] Plugin Code and/or Config
ReactNative log output
20:41:25.334 I Running "meetinger" with {"rootTag":1,"initialProps":{},"fabric":true}
20:41:30.539 E Waiting for previous start action to complete
20:41:31.577 E Waiting for previous start action to complete[Optional] Relevant log output
20:41:24.111 I [c.t.l.logger.LoggerFacade$a a]
╔═════════════════════════════════════════════
║ TSLocationManager version: 3.7.0 (444)
╠═════════════════════════════════════════════
╟─ samsung SM-A135F @ 14 (react)
{
"activityRecognitionInterval": 10000,
"allowIdenticalLocations": false,
"authorization": {},
"autoSync": true,
"autoSyncThreshold": 0,
"backgroundPermissionRationale": {
"title": "Allow {applicationName} to access this device's location even when closed or not in use?",
"message": "[CHANGEME] This app collects location data for FEATURE X and FEATURE Y.",
"positiveAction": "Change to \"{backgroundPermissionOptionLabel}\"",
"negativeAction": ""
},
"batchSync": false,
"configUrl": "",
"crashDetector": {
"enabled": false,
"accelerometerThresholdHigh": 20,
"accelerometerThresholdLow": 4.5,
"gyroscopeThresholdHigh": 20,
"gyroscopeThresholdLow": 4.5
},
"debug": false,
"deferTime": 0,
"desiredAccuracy": 0,
"desiredOdometerAccuracy": 100,
"disableAutoSyncOnCellular": false,
"disableElasticity": false,
"disableLocationAuthorizationAlert": false,
"disableMotionActivityUpdates": false,
"disableProviderChangeRecord": false,
"disableStopDetection": false,
"distanceFilter": 10,
"elasticityMultiplier": 1,
"enableHeadless": false,
"enableTimestampMeta": false,
"extras": {},
"fastestLocationUpdateInterval": -1,
"foregroundService": true,
"geofenceInitialTriggerEntry": true,
"geofenceModeHighAccuracy": false,
"geofenceProximityRadius": 1000,
"geofenceTemplate": "",
"headers": {},
"headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
"heartbeatInterval": -1,
"httpRootProperty": "location",
"httpTimeout": 60000,
"isMoving": false,
"locationAuthorizationRequest": "Always",
"locationTemplate": "",
"locationTimeout": 60,
"locationUpdateInterval": 1000,
"locationsOrderDirection": "ASC",
"logLevel": 4,
"logMaxDays": 3,
"maxBatchSize": -1,
"maxDaysToPersist": 1,
"maxMonitoredGeofences": 97,
"maxRecordsToPersist": -1,
"method": "POST",
"minimumActivityRecognitionConfidence": 75,
"motionTriggerDelay": 0,
"notification": {
"layout": "",
"title": "",
"text": "Location Service activated",
"color": "",
"channelName": "TSLocationManager",
"channelId": "",
"smallIcon": "",
"largeIcon": "",
"priority": -1,
"sticky": false,
"strings": {},
"actions": []
},
"params": {},
"persist": true,
"persistMode": 2,
"schedule": [],
"scheduleUseAlarmManager": false,
"speedJumpFilter": 300,
"startOnBoot": false,
"stationaryRadius": 25,
"stopAfterElapsedMinutes": 0,
"stopOnStationary": false,
"stopOnTerminate": true,
"stopTimeout": 5,
"triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
"url": "",
"useSignificantChangesOnly": false,
"enabled": false,
"schedulerEnabled": false,
"trackingMode": 0,
"didShowBackgroundPermissionRationale": false,
"odometer": 0,
"isFirstBoot": false,
"didLaunchInBackground": false,
"didDeviceReboot": false
}
20:41:24.113 I [c.t.l.logger.LoggerFacade$a a]
╔═════════════════════════════════════════════
║ DEVICE SENSORS
╠═════════════════════════════════════════════
╟─ ✅ ACCELEROMETER: {Sensor name="LIS2DLC12 Accelerometer", vendor="STM", version=1, type=1, maxRange=78.4532, resolution=0.0023942017, power=0.15, minDelay=5000}
╟─ ⚠️ GYROSCOPE: none. Motion-detection system performance will be degraded
╟─ ✅ MAGNETOMETER: {Sensor name="AK09918C Magnetometer", vendor="Asahi Kasei Microdevices", version=2, type=2, maxRange=4900.02, resolution=0.06, power=1.1, minDelay=10000}
╟─ ✅ SIGNIFICANT_MOTION: {Sensor name="Significant Motion", vendor="Samsung Inc.", version=2, type=17, maxRange=1.0, resolution=1.0, power=0.16, minDelay=-1}
╚═════════════════════════════════════════════
20:41:24.114 D [c.t.l.l.TSSQLiteAppender$c run]
ℹ️ Cleared logs older than 72 hours
20:41:24.402 D [c.t.l.l.LifecycleManager onCreate] ☯️ onCreate
20:41:24.404 D [c.t.l.l.LifecycleManager onStart] ☯️ onStart
20:41:24.405 D [c.t.l.l.LifecycleManager onResume] ☯️ onResume
20:41:24.407 I [c.t.l.a.BackgroundGeolocation <init>]
✅ Google Play Services: connected (version code:12451000)
20:41:24.440 I [c.t.l.p.TSProviderManager startMonitoring]
🎾 Start monitoring location-provider changes
20:41:24.455 D [c.t.l.d.s.SQLiteLocationDAO prune]
ℹ️ PRUNE -1 days
20:41:28.345 D [c.t.l.adapter.TSConfig e] ℹ️ Persist config, dirty: [extras, headers, headlessJobService, logLevel, params, schedule]
20:41:28.587 D [c.t.l.g.TSGeofenceManager$d run] evaluation buffer timer elapsed
20:41:28.762 D [c.t.l.u.LocationAuthorization withBackgroundPermission]
ℹ️ LocationAuthorization: Permission granted
20:41:28.766 I - Enable: false → true, trackingMode: 1
20:41:28.774 I [c.t.l.g.TSGeofenceManager start]
🎾 Start monitoring geofences
20:41:28.780 D [c.t.l.http.HttpService startMonitoringConnectivityChanges]
🎾 Start monitoring connectivity changes
20:41:28.790 D [c.t.l.device.DeviceSettings startMonitoringPowerSaveChanges]
🎾 Start monitoring powersave changes
20:41:28.796 I [c.t.l.s.ActivityRecognitionService start]
🎾 Start motion-activity updates
20:41:28.801 D [c.t.l.http.HttpService a]
╔═════════════════════════════════════════════
║ 📶 Connectivity change: connected? true
╠═════════════════════════════════════════════
20:41:28.808 I [c.t.l.service.HeartbeatService stop]
🔴 Stop heartbeat
20:41:28.817 I [c.t.l.service.TrackingService changePace]
🔵 setPace: false → false
20:41:28.835 I [c.t.l.l.TSLocationManager a]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 1 (31968ms old)
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189521,44.470347 hAcc=119.052 et=+4d10h3m4s947ms alt=1076.4000244140625 vAcc=7.248214 vel=0.39851433 sAcc=1.5 bear=191.09027 bAcc=45.0], time: 1766076056864
20:41:28.837 D [c.t.l.l.TSLocationManager a] Median accuracy: 119.052
20:41:28.867 D [c.t.l.u.LocationAuthorization withPermission]
ℹ️ LocationAuthorization: Permission granted
20:41:28.941 D [c.t.l.service.AbstractService a]
🎾 start [LocationRequestService startId: 1, eventCount: 1]
20:41:28.944 I [c.t.l.l.SingleLocationRequest startUpdatingLocation]
🔵 [SingleLocationRequest start, action: 1, requestId: 1]
20:41:28.947 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true]
20:41:28.989 D [c.t.l.service.AbstractService a]
🎾 start [ActivityRecognitionService startId: 1, eventCount: 1]
20:41:28.997 D [c.t.l.s.ActivityRecognitionService a]
🚘 ️DetectedActivity [type=STILL, confidence=100]
20:41:29.007 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false]
20:41:29.062 D [c.t.l.service.AbstractService a]
🎾 1:1 [LocationRequestService startId: 2, eventCount: 1]
20:41:29.064 I [c.t.l.s.LocationRequestService b]
ℹ️ Location availability: false
20:41:29.065 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 2, eventCount: 0, sticky: true]
20:41:29.083 I [c.t.l.s.TSScheduleManager oneShot]
⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
20:41:29.159 D [c.t.l.a.TSLocationManagerActivity a] locationsettings
20:41:29.161 D [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 0
20:41:29.237 I synced displayState. AttachInfo displayState=2
20:41:29.237 I setView = com.android.internal.policy.DecorView@69c0a84 TM=true
20:41:29.259 D [c.t.l.service.AbstractService f]
⚙️︎ ActivityRecognitionService.stopSelfResult(1): true
20:41:29.277 I Relayout returned: old=(0,70,1080,2366) new=(540,1218,540,1218) relayoutAsync=false req=(0,0)0 dur=11 res=0x403 s={true 0xe78c8400} ch=true seqId=0
20:41:29.278 D mThreadedRenderer.initialize() mSurface={isValid=true 0xe78c8400} hwInitialized=true
20:41:29.280 D reportNextDraw android.view.ViewRootImpl.performTraversals:4720 android.view.ViewRootImpl.doTraversal:3288 android.view.ViewRootImpl$TraversalRunnable.run:11346 android.view.Choreographer$CallbackRecord.run:1689 android.view.Choreographer$CallbackRecord.run:1698
20:41:29.281 I Setup new sync=wmsSync-ViewRootImpl@9aa3431[TSLocationManagerActivity]#8
20:41:29.281 I Creating new active sync group ViewRootImpl@9aa3431[TSLocationManagerActivity]#9
20:41:29.282 I registerCallbacksForSync syncBuffer=false
20:41:29.283 I Received frameDrawingCallback syncResult=0 frameNum=1.
20:41:29.283 I mWNT: t=0xdbec3740 mBlastBufferQueue=0xe9bc1f80 fn= 1 mRenderHdrSdrRatio=1.0 caller= android.view.ViewRootImpl$8.onFrameDraw:13843 android.view.ThreadedRenderer$1.onFrameDraw:792 <bottom of call stack>
20:41:29.283 I Setting up sync and frameCommitCallback
20:41:29.287 I Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true
20:41:29.288 I reportDrawFinished seqId=0
20:41:29.318 D [c.t.l.service.AbstractService onDestroy]
🔴 ActivityRecognitionService stopped
20:41:29.375 I stopped(true) old = false
20:41:29.376 D WindowStopped on com.teemco.meetinger/com.transistorsoft.locationmanager.activity.TSLocationManagerActivity set to true
20:41:29.393 D [c.t.l.a.TSLocationManagerActivity onDestroy] locationsettings
20:41:29.397 I dispatchDetachedFromWindow
20:41:31.846 D [c.t.l.service.AbstractService a]
🎾 1:1 [LocationRequestService startId: 3, eventCount: 1]
20:41:31.852 I [c.t.l.s.LocationRequestService b]
ℹ️ Location availability: true
20:41:31.856 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 3, eventCount: 1, sticky: true]
20:41:31.861 D [c.t.l.service.AbstractService a]
🎾 1:1 [LocationRequestService startId: 4, eventCount: 1]
20:41:31.866 I [c.t.l.l.TSLocationManager a]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 1 (168ms old)
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189631,44.470373 hAcc=15.065 et=+4d10h3m39s778ms alt=1076.4000244140625 vAcc=2.993543], time: 1766076091695
20:41:31.871 I [c.t.l.l.TSLocationManager onSingleLocationResult]
🔵 Acquired motionchange position, isMoving: false
20:41:31.872 D [c.t.l.l.TSLocationManager a] Median accuracy: 67.0585
20:41:31.896 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 4, eventCount: 1, sticky: false]
20:41:31.897 D [c.t.l.service.AbstractService b]
🎾 STOP [LocationRequestService startId: 5, eventCount: 1]
20:41:31.899 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 5, eventCount: 0, sticky: false]
20:41:31.905 D [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion]
🎾 Start monitoring stationary region (radius: 150.0m 40.189631,44.4703728 hAcc=15.065)
20:41:31.905 I [c.t.l.d.s.SQLiteLocationDAO persist]
✅ INSERT: d3acec4b-2197-4ee3-b1a0-40e2fcd4df68
20:41:31.954 D [c.t.l.service.AbstractService a]
🎾 motionchange [TrackingService startId: 1, eventCount: 1]
20:41:31.958 I [c.t.l.service.TrackingService k]
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════
20:41:31.964 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [TrackingService startId: 1, eventCount: 0, sticky: false]
20:41:32.020 D [c.t.l.service.AbstractService a]
🎾 STATIONARY_GEOFENCE [GeofencingService startId: 1, eventCount: 1]
20:41:32.025 D [c.t.l.adapter.TSConfig e] ℹ️ Persist config, dirty: [isMoving]
20:41:32.030 I [c.t.l.service.HeartbeatService stop]
🔴 Stop heartbeat
20:41:32.033 D [c.t.l.g.TSGeofenceManager stopMonitoringStationaryRegion]
🔴 Stop monitoring stationary region
20:41:32.045 I [c.t.l.service.TrackingService changePace]
🔵 setPace: false → true
20:41:32.046 I [c.t.l.s.GeofencingService b]
╔═════════════════════════════════════════════
║ GeofencingService: Stationary geofence EXIT
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189631,44.470373 hAcc=15.065 et=+4d10h3m39s778ms alt=1076.4000244140625 vAcc=2.993543]
20:41:32.047 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false]
20:41:32.052 D [c.t.l.service.AbstractService a]
🎾 motionchange [TrackingService startId: 2, eventCount: 1]
20:41:32.053 I [c.t.l.service.TrackingService k]
╔═════════════════════════════════════════════
║ TrackingService motionchange: true
╠═════════════════════════════════════════════
20:41:32.054 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [TrackingService startId: 2, eventCount: 0, sticky: true]
20:41:32.060 I [c.t.l.l.TSLocationManager a]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 2 (363ms old)
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189631,44.470373 hAcc=15.065 et=+4d10h3m39s778ms alt=1076.4000244140625 vAcc=2.993543], time: 1766076091695
20:41:32.063 I [c.t.l.l.TSLocationManager onSingleLocationResult]
🔵 Acquired motionchange position, isMoving: true
20:41:32.064 D [c.t.l.l.TSLocationManager a] Median accuracy: 15.065
20:41:32.071 I [c.t.l.l.TSLocationManager requestLocationUpdates]
🎾 Location-services: ON
20:41:32.072 D [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 0
20:41:32.078 I [c.t.l.d.s.SQLiteLocationDAO persist]
✅ INSERT: ed7eb866-bf38-4710-b134-47769ec41e78
20:41:32.098 I [c.t.l.s.ActivityRecognitionService start]
🎾 Start motion-activity updates
20:41:32.112 D [c.t.l.service.AbstractService b]
🎾 STOP [LocationRequestService startId: 6, eventCount: 1]
20:41:32.113 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [LocationRequestService startId: 6, eventCount: 0, sticky: false]
20:41:32.142 D [c.t.l.service.AbstractService a]
🎾 start [TrackingService startId: 3, eventCount: 1]
20:41:32.144 D [c.t.l.service.TrackingService c]
╔═════════════════════════════════════════════
║ TrackingService: LocationResult
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189631,44.470373 hAcc=15.065 et=+4d10h3m39s778ms alt=1076.4000244140625 vAcc=2.993543]
╟─ Age: 448ms, time: 1766076091695
20:41:32.146 D [c.t.l.l.TSLocationManager onLocationResult]
╔═════════════════════════════════════════════
║ Process LocationResult
╠═════════════════════════════════════════════
20:41:32.146 D [c.t.l.service.AbstractService a]
⚙️︎ FINISH [TrackingService startId: 3, eventCount: 0, sticky: true]
20:41:32.147 D [c.t.l.l.TSLocationManager onLocationResult]
ℹ️ IGNORED: same as last location
20:41:32.264 D [c.t.l.service.AbstractService f]
⚙️︎ GeofencingService.stopSelfResult(1): true
20:41:32.266 D [c.t.l.service.AbstractService onDestroy]
🔴 GeofencingService stopped
20:41:32.325 D [c.t.l.service.AbstractService f]
⚙️︎ LocationRequestService.stopSelfResult(6): true
20:41:32.326 D [c.t.l.service.AbstractService onDestroy]
🔴 LocationRequestService stopped
20:41:32.594 D [c.t.l.u.LocationAuthorization withBackgroundPermission]
ℹ️ LocationAuthorization: Permission granted
20:41:32.596 I - Enable: true → true, trackingMode: 0
20:41:32.598 I [c.t.l.l.TSLocationManager d]
🔴 Location-services: OFF
20:41:32.601 I [c.t.l.s.ActivityRecognitionService stop]
🔴 Stop motion-activity updates
20:41:32.606 D [c.t.l.http.HttpService startMonitoringConnectivityChanges]
🎾 Start monitoring connectivity changes
20:41:32.608 D [c.t.l.device.DeviceSettings startMonitoringPowerSaveChanges]
🎾 Start monitoring powersave changes
20:41:32.609 D [c.t.l.adapter.TSConfig e] ℹ️ Persist config, dirty: [isMoving]
20:41:32.614 I [c.t.l.service.HeartbeatService stop]
🔴 Stop heartbeat
20:41:32.649 I [c.t.l.l.TSLocationManager a]
╔═════════════════════════════════════════════
║ motionchange LocationResult: 3 (953ms old)
╠═════════════════════════════════════════════
╟─ 📍 Location[fused 40.189631,44.470373 hAcc=15.065 et=+4d10h3m39s778ms alt=1076.4000244140625 vAcc=2.993543], time: 1766076091695
20:41:32.653 I [c.t.l.l.TSLocationManager onSingleLocationResult]
🔵 Acquired motionchange position, isMoving: false
20:41:32.655 D [c.t.l.l.TSLocationManager a] Median accuracy: 15.065
20:41:32.841 I [c.t.l.s.TSScheduleManager oneShot]
⏰ Oneshot TERMINATE_EVENT is already pending
20:41:32.874 D [c.t.l.a.TSLocationManagerActivity a] locationsettings
20:41:32.911 I synced displayState. AttachInfo displayState=2
20:41:32.911 I setView = com.android.internal.policy.DecorView@4e10382 TM=true
20:41:32.932 I Relayout returned: old=(0,70,1080,2366) new=(540,1218,540,1218) relayoutAsync=false req=(0,0)0 dur=8 res=0x403 s={true 0xe64bf400} ch=true seqId=0
20:41:32.934 D mThreadedRenderer.initialize() mSurface={isValid=true 0xe64bf400} hwInitialized=true
20:41:32.935 D reportNextDraw android.view.ViewRootImpl.performTraversals:4720 android.view.ViewRootImpl.doTraversal:3288 android.view.ViewRootImpl$TraversalRunnable.run:11346 android.view.Choreographer$CallbackRecord.run:1689 android.view.Choreographer$CallbackRecord.run:1698
20:41:32.935 I Setup new sync=wmsSync-ViewRootImpl@a5345f7[TSLocationManagerActivity]#10
20:41:32.935 I Creating new active sync group ViewRootImpl@a5345f7[TSLocationManagerActivity]#11
20:41:32.936 I registerCallbacksForSync syncBuffer=false
20:41:32.937 I Received frameDrawingCallback syncResult=0 frameNum=1.
20:41:32.937 I mWNT: t=0x97aff460 mBlastBufferQueue=0x98c08480 fn= 1 mRenderHdrSdrRatio=1.0 caller= android.view.ViewRootImpl$8.onFrameDraw:13843 android.view.ThreadedRenderer$1.onFrameDraw:792 <bottom of call stack>
20:41:32.938 I Setting up sync and frameCommitCallback
20:41:32.941 I Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true
20:41:32.942 I reportDrawFinished seqId=0
20:41:33.002 I stopped(true) old = false
20:41:33.002 D WindowStopped on com.teemco.meetinger/com.transistorsoft.locationmanager.activity.TSLocationManagerActivity set to true
20:41:33.012 D [c.t.l.a.TSLocationManagerActivity onDestroy] locationsettings
20:41:33.015 I dispatchDetachedFromWindow