Skip to content

[Help Wanted]: Battery drain with background location tracking on iOS #2649

Description

@PKM-7

Required Reading

  • Confirmed

Plugin Version

4.18.9

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Client-reported issue — exact device model not yet confirmed. Will follow up with iPhone model once collected from the affected user.

Device operating-systems(s)

iOS version not yet confirmed — app supports iOS 15.0+ (Podfile platform target). Will update once collected from the affected user's device.

React Native / Expo version

React Native 0.72.1 (bare RN, not Expo)

What do you require assistance about?

We use react-native-background-geolocation in our production app (a live
safety-monitoring / location-tracking app) and our clients are reporting
significant battery drain caused by continuous background location on iOS.

Important requirement: this is a safety-monitoring app, so tracking behavior
must continue working exactly as it does today — continuous background
location even when the app is killed/terminated, reliable reporting while
stationary and moving, and no gaps in coverage. We are only looking for
configuration/approach changes that reduce battery consumption WITHOUT
reducing tracking reliability, frequency, or accuracy in any way that a user
or their monitor would notice. If a battery improvement requires trading off
tracking reliability, please flag that clearly as a trade-off rather than a
straightforward fix, so we can make that call knowingly.

Specific questions:

  1. preventSuspend: true keeps the app alive in the background on iOS (we
    believe via a silent audio session — our Info.plist UIBackgroundModes
    includes "audio"). Is this the primary battery cost in our setup? What's
    the recommended alternative for an app that must keep reporting location
    while backgrounded?
  2. heartbeatInterval: 15 fires indefinitely every 15s even while stationary —
    is this itself a significant battery cost separate from GPS accuracy?
    What interval would you recommend?
  3. Would you recommend changing desiredAccuracy, distanceFilter, or
    stationaryRadius for our use case, and what values?
  4. Any other iOS-specific config changes to reduce battery use without
    losing reliable background/killed-app tracking?

[Optional] Plugin Code and/or Config

BackgroundGeolocation.ready({
  desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  distanceFilter: 10,
  stopOnTerminate: false,
  startOnBoot: true,
  batchSync: false,
  autoSync: false,
  preventSuspend: true,
  pausesLocationUpdatesAutomatically: false,
  stationaryRadius: 25,
  locationAuthorizationRequest: "Always",
  heartbeatInterval: 15,
  useSignificantChangesOnly: false,
  enableHeadless: true,
});

// onHeartbeat sends the cached event.location — no forced fresh GPS fix:
BackgroundGeolocation.onHeartbeat((event) => {
  if (event?.location?.coords) {
    sendLocationToServer(event.location);
  }
});

// Info.plist UIBackgroundModes: audio, fetch, location, processing, remote-notification

[Optional] Relevant log output

Not yet collected — logLevel is currently LOG_LEVEL_OFF in production (no
verbose logging enabled). Can enable LOG_LEVEL_VERBOSE and send Xcode console
logs / BackgroundGeolocation.emailLog() output from an affected device if
needed for diagnosis.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions