On iOS with Allow once permission the permission is asked again without calling again the getCurrentPosition function
Bug Report
On iOS when the user selects the Allow once permission on getCurrentPosition after a timeout the app is asking again for the location permissions.
Problem
The permission is asked again from the user without user interaction.
What is expected to happen?
The plugin should not ask for permission again.
What does actually happen?
On iOS the didChangeAuthorizationStatus event is triggered after the requested permission is removed by apple. This event restarts the whole flow.
Information
Command or Code
Just call the navigator.geolocation.getCurrentPosition and when asked for permission select allow once. Put the app in the background and wait around 3-5 minutes. After the app is reopened there is a new permission request.
Environment, Platform, Device
iPhone XS iOS 13.6.1
Version information
Cordova: 9.0.0, cordova-ios: 5.1.1 Other Framework: Ionic 5 Operating System: macOS 10.15.6, Xcode 11.7
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
I think a check for the previous status could fix this issue:
//iOS8+
-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
if (__prevStatus != kCLAuthorizationStatusNotDetermined && status == kCLAuthorizationStatusNotDetermined) {
__prevStatus = status;
return;
}
__prevStatus = status;
if(!__locationStarted){
[self startLocation:__highAccuracyEnabled];
}
}