transistorsoft / transistorsoft/react-native-background-geolocation
[Help Wanted]: Battery drain with background location tracking on iOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 446
- PR merge metrics
- No merged PRs in 30d
Description
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:
- 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? - 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? - Would you recommend changing desiredAccuracy, distanceFilter, or
stationaryRadius for our use case, and what values? - 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BackgroundGeolocation.ready configuration, the Podfile platform target, and the Info.plist UIBackgroundModes entries. Enable LOG_LEVEL_VERBOSE and collect Xcode console logs or BackgroundGeolocation.emailLog() output from an affected iPhone after confirming its model and iOS version. Done means identifying supported configuration changes and clearly documenting any battery, reliability, frequency, or accuracy trade-offs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native, typescript
- Domain
- mobile, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100