You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportconstdefaultReadyOptions: Config={// Debugdebug: false,logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,distanceFilter: 10,desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,stopOnTerminate: false,startOnBoot: true,stopOnStationary: false,disableAutoSyncOnCellular: false,useSignificantChangesOnly: false,// Location permissionlocationAuthorizationRequest: "Always",enableHeadless: false,backgroundPermissionRationale: {title: "Confirm your location permissions",message:
"“Allow all the time“ enables John Hancock to collect your location only during a session. We do not collect your location data once you select “End Session“.",positiveAction: "Change to {backgroundPermissionOptionLabel}",negativeAction: "Cancel",},// Location settings permissions alert, when Location is set to `Never` manuallylocationAuthorizationAlert: {titleWhenNotEnabled: "Location services not enabled",titleWhenOff: "Location services are off",instructions:
"To use CareGiver optimally, you must enable 'Always' in Location Services settings",cancelButton: "Cancel",settingsButton: "Settings",},};
Expected Behavior
For Android, in const providerState = await BackgroundGeolocation.getProviderState();
enabled is false when Device location permission is off enabled is true when Device location permission is on
expecting the same behavior in iOS
Actual Behavior
enabled is true when Device location permission is off enabled is true when Device location permission is on
On Android, getting expected result for enabled flag
But on iOS, getting it as true regardless of the device location permission on or off
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;
case 1:
// The user cannot change this app’s status, possibly due to active restrictions such as parental controls being in place
permissionType = LocationPermissionType.RESTRICTED;
break;
case 2:
permissionType = LocationPermissionType.APP_OFF;
// The user denied the use of location services for the app or they are disabled globally in Settings
break;
case 3:
// The user authorized the app to start location services at any time
permissionType = LocationPermissionType.ALWAYS;
break;
case 4:
// Allow Once also translates into Allow while using the app
// The user authorized the app to start location services while it is in use
permissionType = LocationPermissionType.WHEN_IN_USE;
break;
default:
permissionType = LocationPermissionType.OTHER;
}
}
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
The text was updated successfully, but these errors were encountered:
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: