Skip to main content

Location Permissions (beta) Reference

Simplify your location permission gathering logic with Radar's SDK.

Check out our tutorial to implement location permission gathering.

Request location permission#

Use Radar's SDK to request location permissions with a single line of code.

Radar.requestForegroundLocationPermission()
Radar.requestBackgroundLocationPermission()

Get location permission status#

You can get the application's latest location permission status from Radar's SDK.

let updatedLocationPermissionStatus = Radar.getLocationPermissionStatus()

We recommend listening for changes to location permission status by implementing RadarDelegate on iOS or RadarReceiver on Android.

For detailed implementation of linking the listener to your app's state/navigation management, check out our tutorial.

Location permission status#

RadarLocationPermissionStatus exposes various pieces of information obtained from the operating system as well as data collected through our advanced tracking and analysis techniques, providing a comprehensive representation of the location permissions state.

locationPermissionState#

We enumerate the various states via the locationPermissionState enum.

  • NoPermissionGranted: No location permissions has been granted.
  • ForegroundPermissionGranted: Foreground location permission has been granted.
  • ForegroundPermissionRejected: Foreground location permission has been denied.
  • ForegroundPermissionRejectedOnce: (Android only) Foreground location permission has been denied once.
  • ForegroundPermissionPending: Foreground location permissions prompt is on screen.
  • BackgroundPermissionGranted: Background location permission has been granted.
  • BackgroundPermissionRejected: Background location permission has been denied.
  • BackgroundPermissionRejectedONCE: (Android only) Background location permission has been denied once.
  • BackgroundPermissionPending: (iOS only) Foreground location permissions prompt is on screen.
  • PermissionRestricted: (iOS only) No location permission has been granted due to OS restrictions.
  • ApproximatePermissionGranted: (Android only) Coarse foreground location permission has been granted.

RadarLocationPermissionStatus#

In addition to exposing the useful locationPermissionState enumeration, the RadarLocationPermissionStatus object also exposes the underlying data we collected from the OS and our state management. These fields can be used on their own or in conjunction with the locationPermissionState enumeration to power your unique implementation of a location permissions manager.

iOS flags#

  • locationManagerStatus: The authorization status of the iOS location manager (CLAuthorizationStatus).
  • backgroundPopupAvailable: A flag indicating whether the user has been prompted for background location permissions.
  • inForegroundPopup: A flag indicating if the user is currently in the popup for granting foreground location permissions.
  • userRejectedBackgroundPermissions: A flag indicating whether the user has previously rejected background location permissions.

iOS enumerations#

locationManagerStatuslocationManagerStatusinForegroundPopupbackgroundPopupAvailableuserRejectedBackgroundPermissions
NoPermissionGrantedkCLAuthorizationStatusNotDeterminedFalse**
ForegroundPermissionGrantedkCLAuthorizationStatusAuthorizedWhenInUse*FalseTrue
ForegroundPermissionRejectedkCLAuthorizationStatusDenied***
ForegroundPermissionPendingkCLAuthorizationStatusNotDeterminedTrue**
BackgroundPermissionGrantedkCLAuthorizationStatusAuthorizedAlways***
BackgroundPermissionsRejectedkCLAuthorizationStatusAuthorizedWhenInUse*True*
BackgroundPermissionPendingkCLAuthorizationStatusAuthorizedWhenInUse*FalseFalse
PermissionRestrictedkCLAuthorizationStatusRestricted***

Android flags#

  • foregroundPermissionResult: A flag indicating if the user has granted fine location permission.
  • backgroundPermissionResult: A flag indicating if the user has granted background location permissions.
  • shouldShowRequestPermissionRationaleFG: A flag suggesting whether additional rationale should be shown to the user. This is true when the user rejects foreground permissions exactly once.
  • shouldShowRequestPermissionRationaleBG: A flag suggesting whether additional rationale should be shown for background permissions. This is true when the user rejects background permissions exactly once.
  • previouslyDeniedForeground: A flag indicating if the user has previously rejected foreground permissions.
  • previouslyDeniedBackground: A flag indicating if the user has previously rejected background permissions.
  • inLocationPopup: A flag indicating whether the user is currently inside the location permissions popup UI.
  • approximatePermissionsResult: A flag indicating if the user has granted permissions for coarse location instead of fine location.

Android enumerations#

locationManagerStatusbackgroundPermissionResultshouldShowRequestPermissionRationaleBGpreviouslyDeniedBackgroundforegroundPermissionResultinLocationPopupapproximatePermissionsResultshouldShowRequestPermissionRationaleFGpreviouslyDeniedForeground
NO_PERMISSIONS_GRANTEDFalse**FalseFalseFalseFalseFalse
FOREGROUND_PERMISSIONS_GRANTEDFalse*FalseTrue****
ForegroundPermissionsRejectedFalse**FalseFalseFalseFalseTrue
FOREGROUND_LOCATION_PENDINGFalse**FalseTrue***
BACKGROUND_PERMISSIONS_GRANTEDTrue*******
BACKGROUND_PERMISSIONS_REJECTEDFalseFalseTrueTrue****
APPROXIMATE_PERMISSIONS_GRANTEDFalse**FalseFalseTrue**
FOREGROUND_PERMISSIONS_REJECTED_ONCEFalse**FalseFalseFalseTrue*
BACKGROUND_PERMISSION_REJECTED_ONCEFalseTrueTrueTrue****