transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.65k stars 426 forks source link

Battery Drain Issue (IOS) #2112

Closed alihasan21987 closed 1 month ago

alihasan21987 commented 3 months ago

Your Environment IOS

Expected Behavior

Using above Config for Background Geolocation and still battery is consuming more on IOS Devices. I have build install on IOS Device IPhone 13, and it is draining a lot of battery even app is in background or terminated state.

Actual Behavior

How can I solve this problem as I have tried with above config but still it is draining too much battery even on background & terminated state on IOS.

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

Logs ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 3 months ago

Plugin version: 4.9.5

First-of-all, you’re using an old version. See the CHANGELOG.

https://github.com/transistorsoft/react-native-background-geolocation/blob/master/CHANGELOG.md

second, I’ve been running the demo app on my device for nearly 10 years and i don’t experience unusual battery drain.

IMG_1989

alihasan21987 commented 3 months ago

Plugin version: 4.16.5 Platform: iOS or Android IOS OS version:17.5.1 Device manufacturer / model: IPhone 13 React Native version (react-native -v): 0.70.6 Plugin config

BackgroundGeolocation.ready({ debug: false, locationAuthorizationRequest: 'Always', showsBackgroundLocationIndicator: false, logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, desiredAccuracy: desiredAccuracy ? desiredAccuracy : BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: distanceFilter ? distanceFilter : 10, stopOnTerminate: false, disableMotionActivityUpdates: true, startOnBoot: true, heartbeatInterval: 10, enableHeadless: true, locationAuthorizationAlert: { titleWhenNotEnabled: t('title_when_not_enabled'), titleWhenOff: t('title_when_off'), instructions: t('location_auth_alert_instructions'), cancelButton: t('location_auth_alert_cancel'), settingsButton: t('location_auth_alert_settings'), }, stopTimeout: 5, desiredOdometerAccuracy: 10, backgroundPermissionRationale: { title: 'Allow "App" to use your location?', message: 'Please select "Change to Always Allow" below so App can access your location even when you are not using the app.', positiveAction: 'Change to "Always Allow"', negativeAction: 'Cancel', }, }) .then((state) => { if (!state.enabled) { return BackgroundGeolocation.start() .then(() => payload) .catch((error) => Promise.reject(JSON.stringify(error))); } }) .catch((err) => { console.error('Background Geop Location Error : ', err); });

christocracy commented 3 months ago

showsBackgroundLocationIndicator: false,

I suggest you set that to true.

How mush battery % should be used when the app is on driving mode, for an hour with above settings & we are using socket.io to send the real-time location to server?

I have no idea. I do not experience anything unusual with the demo app I've been running on my device for nearly 10 years.

I suggest you disable your socket.io code and compare performance without it.

mshehzad1 commented 3 months ago

@christocracy Could you please answer the above questions?

1- How much battery % should be used when the app is on driving mode, for an hour with above settings & we are using socket.io to send the real-time location to server? Please provide some stats or numbers?

2- Why is the device heating up with the new library version ?

3- How can we reduce the battery drain?

christocracy commented 3 months ago

I have no idea. I do not experience anything unusual with the demo app I've been running on my device for nearly 10 years.

I suggest you disable your socket.io code and compare performance without it.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.