Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Wanted]: Battery Drain & showsBackgroundLocationIndicator Flag #2259

Open
2 of 3 tasks
alihasan21987 opened this issue Jan 28, 2025 · 3 comments
Open
2 of 3 tasks

Comments

@alihasan21987
Copy link

Required Reading

  • Confirmed

Plugin Version

4.16.5

Mobile operating-system(s)

  • iOS
  • Android

What do you require assistance about?

I have set the showsBackgroundLocationIndicator flag to true in my iOS application. However, this has resulted in significant battery drain on iOS devices.

  • I need to understand the specific reason why setting this flag to true is necessary, particularly for iOS version 18.
  • Why does this flag cause higher battery consumption on iOS, and is there a way to optimize or mitigate this issue?

[Optional] Plugin Code and/or Config

BackgroundGeolocation.ready({
    debug: false,
    locationAuthorizationRequest: 'Always',
    showsBackgroundLocationIndicator: true,
    logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
    desiredAccuracy: desiredAccuracy
      ? desiredAccuracy
      : BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
    deferTime: 0,
    startOnBoot: true,
    enableHeadless: true,
    preventSuspend: false,
    stopOnTerminate: false,
    elasticityMultiplier: 1,
    foregroundService: true,
    disableElasticity: false,
    enableTimestampMeta: false,
    disableStopDetection: false,
    geofenceModeHighAccuracy: true,
    useSignificantChangesOnly: false,
    disableAutoSyncOnCellular: false,
    disableMotionActivityUpdates: false,
    distanceFilter: distanceFilter ?? 9,
    disableLocationAuthorizationAlert: false,
    activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER,
    locationAuthorizationAlert: {
      titleWhenOff: t('title_when_off'),
      cancelButton: t('location_auth_alert_cancel'),
      titleWhenNotEnabled: t('title_when_not_enabled'),
      settingsButton: t('location_auth_alert_settings'),
      instructions: t('location_auth_alert_instructions'),
    },
    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',
    },
  })

[Optional] Relevant log output

@christocracy
Copy link
Member

Why does this flag cause higher battery consumption on iOS, and is there a way to optimize or mitigate this issue?

It doesn’t. You’re being superstitious.

@alihasan21987
Copy link
Author

Hi Chris. thanks. Can you let us know the specific reason why setting this flag to true is necessary, particularly for iOS version 18. life360 works without showing this icon so we are wondering why this should be on?

@christocracy
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants