areLocationServicesEnabled

Returns whether the device's system-level Location Services master switch is on.

  • iOS — Settings → Privacy & Security → Location Services

  • Android — Settings → Location

When this is false, no app on the device receives location data regardless of per-app authorization, and startMonitoring will fail with an AFGeofencingResult.Failure / status AFGeofencingStatus.LOCATION_SERVICES_DISABLED. Call this before any permission flow so consumers can guide the user to the master switch first via openLocationSettings.

Kotlin

if (!AFCore.facilities().areLocationServicesEnabled()) {
showAlert("Turn on Location Services") {
AFCore.facilities().openLocationSettings()
}
return
}
AFCore.facilities().startMonitoring()

Swift

guard AFCore.shared.facilities().areLocationServicesEnabled() else {
showAlert("Turn on Location Services") {
AFCore.shared.facilities().openLocationSettings()
}
return
}
try await AFCore.shared.facilities().startMonitoring()