Skip to main content

Location Permissions Reference

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

Check out our tutorial to implement location permission requesting.

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).
  • backgroundPromptAvailable: A flag indicating whether the user has been prompted for background location permissions.
  • inForegroundPrompt: A flag indicating if the user is currently in the prompt for granting foreground location permissions.
  • userRejectedBackgroundPermissions: A flag indicating whether the user has previously rejected background location permissions.

iOS enumerations#

locationManagerStatuslocationManagerStatusinForegroundPromptbackgroundPromptAvailableuserRejectedBackgroundPermissions
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.
  • inLocationPrompt: A flag indicating whether the user is currently inside the location permissions prompt UI.
  • approximatePermissionsResult: A flag indicating if the user has granted permissions for coarse location instead of fine location.

Android enumerations#

locationManagerStatusbackgroundPermissionResultshouldShowRequestPermissionRationaleBGpreviouslyDeniedBackgroundforegroundPermissionResultinLocationPromptapproximatePermissionsResultshouldShowRequestPermissionRationaleFGpreviouslyDeniedForeground
NO_PERMISSIONS_GRANTEDFalse**FalseFalseFalseFalseFalse
FOREGROUND_PERMISSION_GRANTEDFalse*FalseTrue****
FOREGROUND_PERMISSION_REJECTEDFalse**FalseFalseFalseFalseTrue
FOREGROUND_LOCATION_PENDINGFalse**FalseTrue***
BACKGROUND_PERMISSION_GRANTEDTrue*******
BACKGROUND_PERMISSION_REJECTEDFalseFalseTrueTrue****
APPROXIMATE_PERMISSION_GRANTEDFalse**FalseFalseTrue**
FOREGROUND_PERMISSION_REJECTED_ONCEFalse**FalseFalseFalseTrue*
BACKGROUND_PERMISSION_REJECTED_ONCEFalseTrueTrueTrue****