MacosLocationPermissionRequester

Foreground Core Location permission holder.

MacosLocationProvider delegates LocationProvider.permission and LocationProvider.requestPermission to an instance of this class. Use it directly when a custom provider needs the same Core Location permission behavior.

CLAuthorizationStatus maps an authorized status to LocationPermission.Granted, notDetermined to LocationPermission.NotGranted with canRequest = true, denied or restricted to canRequest = false, and an unrecognized value to canRequest = null. CLLocationManager.accuracyAuthorization distinguishes precise from approximate grants. A request calls requestWhenInUseAuthorization() and starts location updates so macOS can present the system prompt.

If permission initialization fails, status reports LocationPermission.Unknown. Collecting location updates retries initialization without requesting permission. Persistent failures report LocationUnavailableReason.UnexpectedFailure.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Whether the process has a usable Core Location implementation.

Link copied to clipboard
val status: StateFlow<LocationPermission>

Current foreground location permission, updated when Core Location reports a change.

Functions

Link copied to clipboard
open override fun close()

Releases the Core Location manager and client after active calls finish.

Link copied to clipboard

Starts a foreground permission request and returns immediately. The result is published to status.