Location Permissions Reference
Simplify your location permission gathering logic with Radar's SDK.
Check out our tutorial to implement location permission gathering.
#
Request location permissionUse Radar's SDK to request location permissions with a single line of code.
- Swift
- Objective-C
- Java
- Kotlin
Radar.requestForegroundLocationPermission()
Radar.requestBackgroundLocationPermission()
[Radar requestForegroundLocationPermission];
[Radar requestBackgroundLocationPermission];
Radar.requestForegroundLocationPermission();
Radar.requestBackgroundLocationPermission();
Radar.requestForegroundLocationPermission()
Radar.requestBackgroundLocationPermission()
#
Get location permission statusYou can get the application's latest location permission status from Radar's SDK.
- Swift
- Objective-C
- Java
- Kotlin
let updatedLocationPermissionStatus = Radar.getLocationPermissionStatus()
RadarLocationPermissionStatus *updatedLocationPermissionStatus = [Radar getLocationPermissionStatus];
RadarLocationPermissionStatus updatedLocationPermissionStatus = Radar.getLocationPermissionStatus();
val 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 statusRadarLocationPermissionStatus
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 flagslocationManagerStatus
: 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 enumerationslocationManagerStatus | locationManagerStatus | inForegroundPopup | backgroundPopupAvailable | userRejectedBackgroundPermissions |
---|---|---|---|---|
NoPermissionGranted | kCLAuthorizationStatusNotDetermined | False | * | * |
ForegroundPermissionGranted | kCLAuthorizationStatusAuthorizedWhenInUse | * | False | True |
ForegroundPermissionRejected | kCLAuthorizationStatusDenied | * | * | * |
ForegroundPermissionPending | kCLAuthorizationStatusNotDetermined | True | * | * |
BackgroundPermissionGranted | kCLAuthorizationStatusAuthorizedAlways | * | * | * |
BackgroundPermissionsRejected | kCLAuthorizationStatusAuthorizedWhenInUse | * | True | * |
BackgroundPermissionPending | kCLAuthorizationStatusAuthorizedWhenInUse | * | False | False |
PermissionRestricted | kCLAuthorizationStatusRestricted | * | * | * |
#
Android flagsforegroundPermissionResult
: 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 enumerationslocationManagerStatus | backgroundPermissionResult | shouldShowRequestPermissionRationaleBG | previouslyDeniedBackground | foregroundPermissionResult | inLocationPopup | approximatePermissionsResult | shouldShowRequestPermissionRationaleFG | previouslyDeniedForeground |
---|---|---|---|---|---|---|---|---|
NO_PERMISSIONS_GRANTED | False | * | * | False | False | False | False | False |
FOREGROUND_PERMISSIONS_GRANTED | False | * | False | True | * | * | * | * |
ForegroundPermissionsRejected | False | * | * | False | False | False | False | True |
FOREGROUND_LOCATION_PENDING | False | * | * | False | True | * | * | * |
BACKGROUND_PERMISSIONS_GRANTED | True | * | * | * | * | * | * | * |
BACKGROUND_PERMISSIONS_REJECTED | False | False | True | True | * | * | * | * |
APPROXIMATE_PERMISSIONS_GRANTED | False | * | * | False | False | True | * | * |
FOREGROUND_PERMISSIONS_REJECTED_ONCE | False | * | * | False | False | False | True | * |
BACKGROUND_PERMISSION_REJECTED_ONCE | False | True | True | True | * | * | * | * |