Skip to content

[Help Wanted]: Not getting event when app in background #2544

@lavpreetsandhu

Description

@lavpreetsandhu

Required Reading

  • Confirmed

Plugin Version

5.0.3

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

iPhone

Device operating-systems(s)

26.0.x

React Native / Expo version

0.84.0

What do you require assistance about?

Right now, we are having two issues

  1. For some reason we are not getting the events/location updates when the app stays in the background or kill mode (for up to even more than 5 minutes), despite moving at 70 mph the whole time so the distance is over 6 miles.

What settings should we change to stop this from happening so we can keep getting proper location updates to show real time tracking?

2.⁠ ⁠Sometimes we don’t receive events for a couple of seconds to minutes and we see activity changes from in-vehicle to still. Why is this happening and what settings should we change to receive consistent updates with the distance filter we have chosen?

[Optional] Plugin Code and/or Config

let state = await BackgroundGeolocation.ready({
  geolocation:{
    desiredAccuracy: BackgroundGeolocation.DesiredAccuracy.High,
    distanceFilter: 5,
    stopTimeout: 5,
    stationaryRadius:5, 
    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'),
    },
    pausesLocationUpdatesAutomatically: true,
    locationAuthorizationRequest: 'Any'
    disableLocationAuthorizationAlert: false,
    showsBackgroundLocationIndicator: true,
    activityType: BackgroundGeolocation.ActivityType.Other,
    disableElasticity: true,
    allowIdenticalLocations: false
  },
  logger:{
    debug: false,
    logLevel: BackgroundGeolocation.LogLevel.Verbose
  },
  activity: {
    stopOnStationary: false,
  },
  app:{
    stopOnTerminate: false,
    startOnBoot:true,
    enableHeadless: true,
    backgroundPermissionRationale:{
      message: message,
      negativeAction: t('location_auth_alert_cancel'),
      positiveAction: `Change to ${permissionOption}`,
      title: t('allow_to_use_your_location'),
    }
  }

[Optional] Relevant log output

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