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

Getting Location update from terminated state after 2000 meters in IOS #2174

Open
alihasan21987 opened this issue Oct 15, 2024 · 6 comments
Open

Comments

@alihasan21987
Copy link

alihasan21987 commented Oct 15, 2024

Your Environment

  • Plugin version: 4.16.5
  • Platform: iOS
  • OS version:17.6.1
  • Device manufacturer / model: IPhone 14 Pro Max
  • 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: true,
    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,
    desiredOdometerAccuracy: 10,
    backgroundPermissionRationale: {
    title: 'Allow "App" to use your location?',
    message:
    'Please select "Change to Always Allow" below so the App can access your location even when you are not using the app.',
    positiveAction: 'Change to "Always Allow"',
    negativeAction: 'Cancel',
    },
    })

Expected Behaviour

It should give location update after 200 meters when app is in terminated State.

Actual Behaviour

It is giving location update after 2000 meters when app is in terminated State.

Steps to Reproduce

1.Install App with above Plugin Config.
2.Move App to terminated State & start on route with device.
3.It will give location update after about 2000 meters.

Logs [background-geolocation (21).log](https://github.com/user-attachments/files/17377677/background-geolocation.21.log)
@christocracy
Copy link
Member

It will give location update after about 2000 meters.

200 meters is typical, not a guarantee. The plug-in has no control over this. It depends upon the environment; the presence of wifi signals and distance between cell towers.

if it works, it works.

@mshehzad1
Copy link

@christocracy

In some cases, the iOS app fails to capture locations when it's in a killed state and the user starts moving after being stationary for several hours. Despite the device being moved, the location services do not trigger for 10 to 15 km. Can you clarify why this behavior occurs with Transistorsoft on iOS, while it works as expected in the same scenario on Android, even in the killed state?

@christocracy
Copy link
Member

Can you clarify why this behavior occurs with Transistorsoft on iOS, while it works as expected in the same scenario on Android

There is no correlation between the two.

It can only be due to the environment (assuming you’ve granted “Always” permission and Wifi is not disabled). I suggest you test in the iOS Simulator with location simulated with “Freeway Drive”. If it works properly in the simulator, that’s all you can do.

@mshehzad1
Copy link

This works properly when the app is active, but the issue occurs when the app is stationary, and then starts moving after some time, Only the start location are not coming in properly way.

Both devices have the same internet connection, and on Android it works, but in iOS it did activate after 1000 to 2000 metes of drive.

Just want to understand is this actual behaviour of TransistorSoft in iOS devices?

@christocracy
Copy link
Member

The iOS plugin relies on a 200 meter geofence around the last known position, the exit of which signals the device is moving.

it’s completely up to the OS to monitor and determine when this geofence is exited. This completely depends upon the nature of the environment (presence of wifi signals, spacing of cell towers).

there is nothing the plug-in can do to improve this behaviour for some particular device in some particular environment. You are completely in the hands of the OS.

in my 10 years experience, testing throughout the world, the typical distance to detect movement is about 200 meters, but there is no guarantee.

see my road trip in France this summer:
https://www.transistorsoft.com/lab/france

@christocracy
Copy link
Member

Test in the simulator.

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

3 participants