react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Slowness with getCurrentPosition after start was called
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