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

Slowness with getCurrentPosition after start was called #2170

Open
kirbyjs opened this issue Oct 10, 2024 · 2 comments
Open

Slowness with getCurrentPosition after start was called #2170

kirbyjs opened this issue Oct 10, 2024 · 2 comments

Comments

@kirbyjs
Copy link

kirbyjs commented Oct 10, 2024

Your Environment

  • Plugin version: 4.13.3
  • Platform: iOS
  • OS version: 18
  • Device manufacturer / model: iPhone 16 Pro simulator
  • React Native version (react-native -v): 0.72.14
  • Plugin config
    await BackgroundGeolocation.ready({
      disableMotionActivityUpdates: true,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10,
      stopTimeout: 1,
      debug: false,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      stopOnTerminate: true,
      startOnBoot: false,
      useSignificantChangesOnly: true,
      params: {
        platform: Platform.OS === 'ios' ? 'iOS' : 'Android',
      },
      headers: {
        Authorization: `Bearer ${token}`,
      },
      url: url,
      autoSync: true,
      locationAuthorizationRequest: 'WhenInUse',
    });

   // BackgroundGeolocation.start();

    const location = await BackgroundGeolocation.getCurrentPosition({
      persist: true,
      samples: 1,
    });

Expected Behavior

I'm not sure if this is expected behavior, but when calling start and then calling getCurrentPosition, made getCurrentPosition take 30-60 seconds to resolve. Moving the start call to be after getCurrentPosition, made it resolve instantly.

This was not an issue in version 4.12.1, it was added right after that. It's also only an issue on iOS, android always resolves right away.

Actual Behavior

I would think that it wouldn't matter if start was called before getCurrentPosition, and that it wouldn't result in additional load time.

Steps to Reproduce

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

Plugin version: 4.13.3

Why are you using a version from a year ago?

I strongly doubt calling .getCurrentPosition before or after .start() has any different behaviour. It is likely a coincidence. Are you testing outdoors?

See CHANGELOG: https://github.com/transistorsoft/react-native-background-geolocation/blob/master/CHANGELOG.md

@christocracy
Copy link
Member

christocracy commented Oct 10, 2024

Also, the first thing to do when something unusual occurs (before posting an issue) is to carefully observe the plug-in logs with your app launched in XCode.

see wiki “Debugging”.

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