react-native-background-geolocation: Tracking in the background stops automatically

Your Environment

  • Plugin version: 2.13.4
  • Platform: Android
  • OS version: 8.1
  • Device manufacturer / model: OnePlus5T
  • React Native version (react-native -v): 0.57.0
  • Plugin config { reset: true, desiredAccuracy: 0, distanceFilter: 10, stopOnStationary: false, stopTimeout: 2, logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, stopOnTerminate: false, startOnBoot: true, forceReloadOnBoot: true, forceReloadOnHeartbeat: true, forceReloadOnLocationChange: true, forceReloadOnMotionChange: true, heartbeatInterval: 600, notificationPriority: BackgroundGeolocation.NOTIFICATION_PRIORITY_HIGH, notificationText: ‘Washmen driver app running’, url: ‘https://xxxx.xxxxx.xxx/xxx/ping’, batchSync: true, maxBatchSize: 3, autoSync: true, autoSyncThreshold: 3, headers: { Authorization: 'Bearer ’ + (variable) }, enableHeadless: true, foregroundService: true, disableStopDetection: true }

Expected Behavior

I have configured a headless task for when the app is killed, and a heartbeat listener for when the app is in foreground. The app as you can see above is configured to reload in case of the app got killed Both the Heartbeat & the headless tasks after sometime become inactive. I am using them to check on data and location and issue a notification and to refresh my token each 30 min from it being updated. So the way I know they become disabled, is that I try to turn off location per say and no notification appears. Tracking keeps working for a bit more… but dies after some time, the bar in the notification section disappears as if the whole thing just died. The app is still open in the background though.

Actual Behavior

Heartbeats are not stable and cannot rely on them Headless task is terminating Geolocation is also terminating after sometime

Steps to Reproduce

Context

Track my fleet of drivers

Debug logs

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 51 (23 by maintainers)

Most upvoted comments

Also enable Javascript Debugging for your app to see if you’re getting Javascript errors from your headless code.

Let your app run headless while monitoring $ adb logcat unfiltered. See if you can capture the point where / if the Service is terminated.