Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-8826

cordova-plugin-geolocation should reverse permissions request in ios8

    XMLWordPrintableJSON

Details

    Description

      I would like to suggest a change to how the geolocation plugin requests
      permissions in iOS8. In the event that both iOS8 NSLocation usage
      permissions exist, I suggest that we first request the least permissive one
      (NSLocationWhenInUseUsageDescription).

      This should amount to simply reversing the logic in CDVLocation.m:

      if([[NSBundle mainBundle]
      objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"])
      {
                  [self.locationManager  requestWhenInUseAuthorization];
      } else if([[NSBundle mainBundle] objectForInfoDictionaryKey:@
      "NSLocationAlwaysUsageDescription"]) {
                  [self.locationManager requestAlwaysAuthorization];
      }
      

      I have a use case where an app launches with both descriptions set, but
      depending on client configuration the "AlwaysInUse" permission may not be necessary. As the logic is written now, the plugin will always request that one, which could look a bit extreme to the end user.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jasonpeterson Jason Peterson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: