onProviderChange when 'Ask Next Time Or When I Share' is selected shows incorrect 'accuracyAuthorization'
Might be small and/or insignificant but Ive noticed that when selecting 'Ask Next Time Or When I Share' in location settings 'accuracyAuthorization' shows 0 or Full accuracy in the console logs despite precise location being off.
Your Environment
- Plugin version: ^4.14.5
- Platform: iOS
- OS version: iOS 17.2
- Device manufacturer / model: Apple / iPhone 15 Pro Simulator
- React Native version (
react-native -v): react-native-cli: 2.0.1 / react-native: 0.72.4 - Plugin config: Default config in the demo app in master
// Debug
reset: false,
debug: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
transistorAuthorizationToken: token,
// Geolocation
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION,
distanceFilter: 10,
stopTimeout: 5,
// Permissions
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: {
title: "Allow {applicationName} to access this device's location even when closed or not in use.",
message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel'
},
// HTTP & Persistence
autoSync: true,
maxDaysToPersist: 14,
// Application
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true
Expected Behavior
Since Precision Location is turned off onProviderChange should have accuracyAuthorization be 1 or ACCURACY_AUTHORIZATION_REDUCED for any access option selected.
Actual Behavior
When selecting 'Ask Next Time Or When I Share' accuracyAuthorization comes back as 0 or ACCURACY_AUTHORIZATION_FULL
Steps to Reproduce
- Boot up demo app and navigate to Hello World App
- Click on the bottom left Navigation button to trigger permission dialog
- Disable 'Precise Location' and grant 'While Using The App' permissions
- Observe accuracyAuthorization is correctly 1 in the
onProviderChangelog - Go to Demo app location settings
- Observe in the console logs that clicking any location option other than 'Ask Next Time Or When I Share' yields a 1 result for 'accuracyAuthorization' which is correct because precision is off. However, when selecting 'Ask Next Time Or When I Share' the result is 0 which is incorrect as precision is turned off.
Context
Only prompt the user to grant temporary full accuracy when they turned it off in their selection
Debug logs
Logs
LOG Running "BGGeolocation" with {"rootTag":1,"initialProps":{}}
LOG [Authorization registerTransistorAuthorizationHandler]
LOG [onProviderChange] {"accuracyAuthorization": 0, "enabled": false, "gps": true, "network": true, "status": 0}
WARN [onLocation] ERROR: 1
WARN Possible Unhandled Promise Rejection (id: 0):
1
LOG [onProviderChange] {"accuracyAuthorization": 1, "enabled": true, "gps": true, "network": true, "status": 4}
WARN [requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: {"error": "I"}
LOG [onProviderChange] {"accuracyAuthorization": 0, "enabled": false, "gps": true, "network": true, "status": 0}
LOG [onProviderChange] {"accuracyAuthorization": 1, "enabled": false, "gps": true, "network": true, "status": 2}
LOG [onProviderChange] {"accuracyAuthorization": 0, "enabled": false, "gps": true, "network": true, "status": 0}
WARN [requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: {"error": "A"}
LOG [onProviderChange] {"accuracyAuthorization": 1, "enabled": true, "gps": true, "network": true, "status": 4}
LOG [onProviderChange] {"accuracyAuthorization": 1, "enabled": true, "gps": true, "network": true, "status": 3}
WARN [requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: {"error": "A"}
WARN [requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: {"error": "A"}
https://github.com/transistorsoft/react-native-background-geolocation/assets/51167848/de9232a4-9ac8-4084-babb-fe38c6247cf9