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

On iOS with Allow once permission the permission is asked again without calling again the getCurrentPosition function #211

Open
3 tasks done
tujlaky opened this issue Sep 10, 2020 · 1 comment

Comments

@tujlaky
Copy link

tujlaky commented Sep 10, 2020

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

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@tujlaky
Copy link
Author

tujlaky commented Sep 10, 2020

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];
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant