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

Location Updates Stops Immediately when user stops on a traffic signal even ignored the stopTimeout. #2234

Open
alihasan21987 opened this issue Dec 18, 2024 · 11 comments

Comments

@alihasan21987
Copy link

alihasan21987 commented Dec 18, 2024

Your Environment

  • Plugin version: 4.16.5
  • Platform: Android
  • OS version: 13
  • Device manufacturer / model: Samsung
  • 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,
    deferTime: 0,
    startOnBoot: true,
    enableHeadless: true,
    preventSuspend: false,
    stopOnTerminate: false,
    elasticityMultiplier: 1,
    foregroundService: true,
    disableElasticity: false,
    enableTimestampMeta: false,
    disableStopDetection: false,
    geofenceModeHighAccuracy: false,
    useSignificantChangesOnly: false,
    disableAutoSyncOnCellular: false,
    disableMotionActivityUpdates: true,
    distanceFilter: distanceFilter ?? 9,
    disableLocationAuthorizationAlert: false,
    activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER,
    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,
    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',
    },
  })

Expected Behavior

It should not stops location updates untill stopTimeout time breaches.

Actual Behavior

It stops location updates as user stops on a signal for 30 seconds, however I have mentioned the stopTimeout interval of 5 minutes,

Steps to Reproduce

Context

Debug logs

Logs

background-geolocation (22).log

@christocracy
Copy link
Member

What specific timestamp range in your logs are you interested in?

@alihasan21987
Copy link
Author

alihasan21987 commented Dec 19, 2024 via email

@alihasan21987
Copy link
Author

alihasan21987 commented Dec 20, 2024 via email

@christocracy
Copy link
Member

Platform: iOS

Why are you providing Android logs for an iOS issue?

Why are you concerned about a period of 2 minutes?

@alihasan21987
Copy link
Author

I am concerned because when the user stops at a traffic signal, I do not receive any updates during this period. Instead, it continues to display the user's speed from the previous location. However, the user mentioned that they were stationary, waiting for the traffic signal to turn green. As a result, I am not getting the updated speed. Additionally, I apologize for mistakenly specifying the platform as iOS.

@christocracy
Copy link
Member

There is nothing unusual in the logs.

If you want better performance, DON'T DO THIS:

disableMotionActivityUpdates: true,

@alihasan21987
Copy link
Author

alihasan21987 commented Dec 30, 2024

I set disableMotionActivityUpdates to false and tested the scenario again. The issue persists: location data is not provided when the user stops at a traffic signal for some time. Once the user starts moving again, location updates are delayed by 1 minute and 30 seconds.In some cases, user is not getting location update at all when moving after some times.

@christocracy
Copy link
Member

showsBackgroundLocationIndicator: false,

Set this to true

@alihasan21987
Copy link
Author

alihasan21987 commented Dec 31, 2024

@christocracy According to the documentation, this is primarily a status bar change on iOS devices. Will these settings have a significant impact on location updates when the user stop or start moving after being stationary for some time?

@christocracy
Copy link
Member

Since iOS 18, it’s more than just a status bar change. Try it and see.

@alihasan21987
Copy link
Author

alihasan21987 commented Jan 6, 2025

@christocracy I have enabled showsBackgroundLocationIndicator, but I encountered an issue where the location updates stop when the iOS device remains stationary for some time, e.g. remain still in my pocket or on a car dashboard. However, as soon as I pick up the device from my pocket or move the device from my car dashboard, the location updates resume automatically.

Still, I am not getting location data when the user stops at a traffic signal for some time and hence the speed from last location is displayed which is 20, not the updated one as user stops on traffic signal.

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