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

Passing enableBackgroundLocationUpdates is ignored #316

Open
tanoc opened this issue May 23, 2024 · 1 comment
Open

Passing enableBackgroundLocationUpdates is ignored #316

tanoc opened this issue May 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@tanoc
Copy link

tanoc commented May 23, 2024

Platforms

iOS

Versions

  • react-native-geolocation: 3.2.1
  • react-native: 0.74.1
  • react: 18.2.0

Description

It looks like the function converting between the js dictionary and the RNCGeolocationConfiguration struct does not set enableBackgroundLocationUpdates:

+ (RNCGeolocationConfiguration)RNCGeolocationConfiguration:(id)json
{
NSDictionary<NSString *, id> *options = [RCTConvert NSDictionary:json];
return (RNCGeolocationConfiguration) {
.skipPermissionRequests = [RCTConvert BOOL:options[@"skipPermissionRequests"]],
.authorizationLevel = [RCTConvert RNCGeolocationAuthorizationLevel:options[@"authorizationLevel"]]
};
}

I notice this because enableBackgroundLocationUpdates is never called with skipPermissionRequests set to true because _locationConfiguration.enableBackgroundLocationUpdates is always set to false

if (!_locationConfiguration.skipPermissionRequests) {
[self requestAuthorization:nil error:nil];
} else if (_locationConfiguration.enableBackgroundLocationUpdates) {
[self enableBackgroundLocationUpdates];
}

@tanoc tanoc added the bug Something isn't working label May 23, 2024
@tomthought
Copy link

Experiencing this as well.

Looks like just need to add something like this:
.enableBackgroundLocationUpdates = [RCTConvert BOOL:options[@"enableBackgroundLocationUpdates"]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants