Skip to content

[Bug]: Not getting event when app is killed by user on iOS #2548

@lavpreetsandhu

Description

@lavpreetsandhu

Required Reading

  • Confirmed

Plugin Version

5.0.3

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

iPhone 11, iPhone 14 Pro

Device operating-systems(s)

iOS 26.3.x

React Native / Expo version

0.84.0

What happened?

I am experiencing an issue: if the user terminates the app (via a "Swipe-to-Kill" from the app switcher), user stop receiving location updates. Even if the user begins traveling by car, the background location stops until the app is manually reopened. This is only happening with iOS, for Android, this is not an issue.

I wanted to clarify if this is the expected behavior for this library or if I am missing a specific configuration.

Configuration & Logs:
Below are my settings and logs. You can see that between 17:20:33 and 17:56:08, there is a gap in the logs. I started my trip around 17:45 and waited for about 10 minutes before finally reopening the app to trigger the updates again.

Thanks, and waiting for your reply.

Plugin Code and/or Config

jsx
let state = await BackgroundGeolocation.ready({
      reset: true,
      geolocation:{
        desiredAccuracy: BackgroundGeolocation.DesiredAccuracy.High,
        distanceFilter: 5,
        stopTimeout: 5,
        stationaryRadius: 25, 
        pausesLocationUpdatesAutomatically: false,
        locationAuthorizationRequest: 'Always',
        disableLocationAuthorizationAlert: false,
        showsBackgroundLocationIndicator: true,
        activityType: BackgroundGeolocation.ActivityType.OtherNavigation,
        disableElasticity: true,
        allowIdenticalLocations: false
      },
      logger:{
        debug: true,
        logLevel: BackgroundGeolocation.LogLevel.Verbose
      },
      activity: {
        stopOnStationary: false,
      },
      app:{
        stopOnTerminate: false,
        startOnBoot:true,
        enableHeadless: true,
      },
    });

Relevant log output

2026-04-06 17:20:00.925 ℹ️-[TSDBLogger db_save] Log committed

2026-04-06 17:20:03.026 
╔═══════════════════════════════════════════════════════════
║ -[TSTrackingService onMotionActivityChange:] | still/33 | isMoving: 0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.026 ℹ️-[TSTrackingService onMotionActivityChange:] [StopDetection] Ignored — low confidence: 33 < 70

2026-04-06 17:20:03.120 🔵-[TSTrackingService onStopTimeout] 🛑 stopTimeout fired

2026-04-06 17:20:03.122 🟢-[TSTrackingService changePace:] isMoving: 0

2026-04-06 17:20:03.123 ℹ️-[TSConfig onChange:] state.isMoving

2026-04-06 17:20:03.132 🟢-[TSLocationRequestService requestLocation:] [motionchange] maximumAge: 5000

2026-04-06 17:20:03.132 🛑-[TSTimerService stop] ⏰ [stopTimeout]

2026-04-06 17:20:03.140 
1:📍<+29.87202802,+74.12825685> +/- 17.29m (speed 0.05 mps / course 170.60) @ 06/04/26, 5:20:02 PM India Standard Time | age: 1137 ms

2026-04-06 17:20:03.140 
╔═══════════════════════════════════════════════════════════
║ -[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 [motionchange] desiredAccuracy: 20.0 m, maximumAge: 5000 ms
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.140 ✅-[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 meets accuracy & staleness: return early: <+29.87202802,+74.12825685> +/- 17.29m (speed 0.05 mps / course 170.60) @ 06/04/26, 5:20:02 PM India Standard Time

2026-04-06 17:20:03.149 
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager evaluateProximity:] Found 3 / 3 within 2000 m
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.153 🟢-[TSTrackingService startMonitoringSignificantLocationChanges] 

2026-04-06 17:20:03.153 ℹ️-[TSOdometer incrementOdometer] 4686.32m ±192.58m

2026-04-06 17:20:03.155 ℹ️-[TSOdometer onMotionChange:] Filter state: odometer=4686.32m ±194.13m

2026-04-06 17:20:03.155 ℹ️-[TSLocationMetricsEngine onMotionChange:] [Metrics] onMotionChange 0: cleared rolling buffers; preserved last anchor.

2026-04-06 17:20:03.156 🔵-[TSTrackingService startMonitoringStationaryRegion:radius:] Radius: 150

2026-04-06 17:20:03.157 🔵-[TSTrackingService beginStartDetection] 

2026-04-06 17:20:03.157 🟢-[TSLocationRequestService requestLocation:] [motionState] maximumAge: 3000

2026-04-06 17:20:03.157 🟢-[TSTimerService startWithInterval:repeating:callback:] ⏰ [timeAcquisitionBufferTimer] Starting timer: 3.00s repeating: 0

2026-04-06 17:20:03.209 ✅-[TSBackgroundTaskManager createBackgroundTask] Created background task: 352

2026-04-06 17:20:03.209 🟢-[TSTimerService startWithInterval:repeating:callback:] ⏰ [startDetectionTimer] Starting timer: 30.00s repeating: 0

2026-04-06 17:20:03.209 🛑-[TSTrackingService stopUpdatingLocation] 

2026-04-06 17:20:03.209 
1:📍<+29.87202672,+74.12825421> +/- 17.54m (speed 0.08 mps / course 170.60) @ 06/04/26, 5:20:03 PM India Standard Time | age: 207 ms

2026-04-06 17:20:03.209 
╔═══════════════════════════════════════════════════════════
║ -[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 [motionState] desiredAccuracy: 60.0 m, maximumAge: 3000 ms
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.209 ✅-[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 meets accuracy & staleness: return early: <+29.87202672,+74.12825421> +/- 17.54m (speed 0.08 mps / course 170.60) @ 06/04/26, 5:20:03 PM India Standard Time

2026-04-06 17:20:03.214 ℹ️-[TSTrackingService onUpdateState:] Classifier suggests still/33 at speed=0.08

2026-04-06 17:20:03.214 ℹ️-[TSTrackingService onUpdateState:] Is location beyond stationaryRadius? 📍Δd: 0.3, radius: 150.0

2026-04-06 17:20:03.241 ✅-[TSDataStore persist:] 💾 INSERT: 55E2381D-3960-408A-BADA-25493952D57C (type: 0, persistMode: 2, maxRecords: -1)

2026-04-06 17:20:03.241 
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:] 
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.241 
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] success=0 queued_before=0 synced=0 pages=0 duration_ms=0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:03.666 
╔═══════════════════════════════════════════════════════════
║ -[TSTrackingService onMotionActivityChange:] | unknown/100 | isMoving: 0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:06.161 🟢-[TSTimerService startWithInterval:repeating:callback:] ⏰ [preventSuspend] Starting timer: 23.16s repeating: 0

2026-04-06 17:20:06.161 🔵-[TSBackgroundTaskManager startPreventSuspendTimer:] BG time remaining: 28 | Total tasks: 1

2026-04-06 17:20:06.162 🛑-[TSTimerService stop] ⏰ [timeAcquisitionBufferTimer]

2026-04-06 17:20:29.408 🔵-[TSBackgroundTaskManager onPreventSuspendTimer] Prevent-suspend timer fired! (bg time remaining: 4.908659)

2026-04-06 17:20:29.408 🛑-[TSTimerService stop] ⏰ [preventSuspend]

2026-04-06 17:20:29.409 ℹ️-[TSBackgroundTaskManager onPreventSuspendTimer]_block_invoke Authorization: 3

2026-04-06 17:20:29.448 🟢-[TSTimerService startWithInterval:repeating:callback:] ⏰ [timeAcquisitionBufferTimer] Starting timer: 3.00s repeating: 0

2026-04-06 17:20:32.454 🟢-[TSTimerService startWithInterval:repeating:callback:] ⏰ [preventSuspend] Starting timer: 23.19s repeating: 0

2026-04-06 17:20:32.454 🔵-[TSBackgroundTaskManager startPreventSuspendTimer:] BG time remaining: 28 | Total tasks: 1

2026-04-06 17:20:32.454 🛑-[TSTimerService stop] ⏰ [timeAcquisitionBufferTimer]

2026-04-06 17:20:32.995 
╔═══════════════════════════════════════════════════════════
║ -[TSTrackingService onMotionActivityChange:] | still/33 | isMoving: 0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:20:33.308 🔵-[TSTrackingService endStartDetection] 

2026-04-06 17:20:33.308 🛑-[TSTimerService stop] ⏰ [preventSuspend]

2026-04-06 17:20:33.308 🛑-[TSTimerService stop] ⏰ [startDetectionTimer]

2026-04-06 17:20:33.308 ✅-[TSBackgroundTaskManager stopBackgroundTask:]_block_invoke 352 OF {(
    352
)}

2026-04-06 17:56:08.212 ℹ️-[TSDBLogger db_save] Log committed

2026-04-06 17:56:08.213 ℹ️-[TSDBLogger db_delete] maxAge: 604800

2026-04-06 17:56:08.228 ℹ️-[TSAppState onEnterForeground] 

2026-04-06 17:56:08.229 🔵-[TSTrackingService onResume] enabled? 1

2026-04-06 17:56:08.230 ℹ️-[TSLocationDAO purge:] 1

2026-04-06 17:56:08.238 ℹ️-[TSDBLogger db_save] Log committed

2026-04-06 17:56:08.340 
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:] 
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:08.340 
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] success=0 queued_before=0 synced=0 pages=0 duration_ms=0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:08.366 
╔═══════════════════════════════════════════════════════════
║ -[TSTrackingService onMotionActivityChange:] | unknown/100 | isMoving: 0
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:08.396 📍🔐-[TSLocationAuthorization applicationDidBecomeActive] Application became active - refreshing authorization state

2026-04-06 17:56:12.053 ℹ️-[TSAppState onEnterBackground] 

2026-04-06 17:56:42.796 ℹ️-[TSTrackingService locationManager:didUpdateLocations:] Location is beyond stationary region: automatically entering moving state

2026-04-06 17:56:42.797 🟢-[TSTrackingService changePace:] isMoving: 1

2026-04-06 17:56:42.797 ℹ️-[TSConfig onChange:] state.isMoving

2026-04-06 17:56:42.801 🟢-[TSLocationRequestService requestLocation:] [motionchange] maximumAge: 5000

2026-04-06 17:56:42.809 
1:📍<+29.87348799,+74.12888922> +/- 47.38m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:45:36 PM India Standard Time | age: 666671 ms

2026-04-06 17:56:42.809 
╔═══════════════════════════════════════════════════════════
║ -[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 [motionchange] desiredAccuracy: 20.0 m, maximumAge: 5000 ms
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:42.812 
2:📍<+29.86260040,+74.17607603> +/- 2000.00m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:56:42 PM India Standard Time | age: 8 ms

2026-04-06 17:56:42.812 
╔═══════════════════════════════════════════════════════════
║ -[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 [motionchange] desiredAccuracy: 20.0 m, maximumAge: 5000 ms
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:42.831 
3:📍<+29.86260037,+74.17607613> +/- 2000.00m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:56:42 PM India Standard Time | age: 9 ms

2026-04-06 17:56:42.831 
╔═══════════════════════════════════════════════════════════
║ -[TSSingleLocationRequest trySatisfyWithLocation:now:] 📍🔎 [motionchange] desiredAccuracy: 20.0 m, maximumAge: 5000 ms
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:42.831 ℹ️+[TSLocationHelper pickBestLocationBetween:and:desiredAccuracy:] desiredAccuracy: 20.000000
- A: 📍<+29.87348799,+74.12888922> +/- 47.38m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:45:36 PM India Standard Time
- B: 📍<+29.87348799,+74.12888922> +/- 47.38m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:45:36 PM India Standard Time

2026-04-06 17:56:42.832 
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager evaluateProximity:] Found 3 / 3 within 2000 m
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:42.835 🟢-[TSTrackingService startMonitoringSignificantLocationChanges] 

2026-04-06 17:56:42.836 ℹ️-[TSOdometer onMotionChange:] Filter state: odometer=4686.32m ±194.13m

2026-04-06 17:56:42.836 🟢-[TSTrackingService startUpdatingLocation] Location-services: ON

2026-04-06 17:56:42.887 
╔═══════════════════════════════════════════════════════════
║ -[TSTrackingService locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m
╚═══════════════════════════════════════════════════════════

2026-04-06 17:56:42.887 📍<+29.86260037,+74.17607613> +/- 2000.00m (speed -1.00 mps / course -1.00) @ 06/04/26, 5:56:42 PM India Standard Time | age: 46 ms

2026-04-06 17:56:42.909 ✅-[TSDataStore persist:] 💾 INSERT: E0CB9EF0-B12E-4907-8701-72393433F9A7 (type: 0, persistMode: 2, maxRecords: -1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions