Skip to content

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

Open
@alihasan21987

Description

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

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