-
Notifications
You must be signed in to change notification settings - Fork 426
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
getProviderState getting incorrect enabled
flag for iOS
#2212
Comments
in iOS, with
|
@christocracy looking for advice and workarounds for this? |
hi @christocracy any info on how to resolve this would be great. Our invoicing module relies on this. |
I'm not seeing any issue here. Perhaps you need to provide more exact reproduction steps and code. |
This issue is stale because it has been open for 30 days with no activity. |
Hi @christocracy - sorry for the delay! const providerState = await BackgroundGeolocation.getProviderState(); This should return "enabled": false if user has disabled location services for the device. It returns "enabled": false only for Android. However, it always returns "enabled": true for IOS, even if location is OFF (user disabled location services in the device). Please refer to Jayesh's Nov 22 note. |
Your Environment
Plugin version: 4.17.4
Platform: iOS
OS version: 18.1.1
Device manufacturer / model: iPhone 16 Pro
React Native version (
react-native -v
):expo-env-info 1.2.1 environment info:
System:
OS: macOS 15.1.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.4.1 - ~/.nvm/versions/node/v22.4.1/bin/node
npm: 10.8.1 - ~/.nvm/versions/node/v22.4.1/bin/npm
Watchman: 2024.11.11.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.1, iOS 18.1, macOS 15.1, tvOS 18.1, visionOS 2.1, watchOS 11.1
Android SDK:
API Levels: 28, 32, 33, 34, 35
Build Tools: 30.0.3, 33.0.0, 33.0.1, 34.0.0, 35.0.0
System Images: android-34 | Google APIs ARM 64 v8a
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12550806
Xcode: 16.1/16B40 - /usr/bin/xcodebuild
npmPackages:
expo: ^51.0.11 => 51.0.26
expo-router: ~3.5.23 => 3.5.23
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.5 => 0.74.5
react-native-web: ~0.19.6 => 0.19.12
Expo Workflow: bare
Plugin config
Expected Behavior
For Android, in
const providerState = await BackgroundGeolocation.getProviderState();
enabled
is false when Device location permission is offenabled
is true when Device location permission is onexpecting the same behavior in iOS
Actual Behavior
enabled
is true when Device location permission is offenabled
is true when Device location permission is onSteps to Reproduce
Context
Trying to capture the accurate permission type for both Android and iOS:
if (!providerState.enabled) {
// The user has disabled location services for the device
permissionType = LocationPermissionType.DEVICE_OFF;
} else {
switch (providerState.status) {
case 0:
// The user has not chosen whether the app can use location services
permissionType = LocationPermissionType.NOT_DETERMINED;
break;
}
Debug logs
Logs
The text was updated successfully, but these errors were encountered: