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 the manager cannot be allocated, status reports LocationPermission.Granted at LocationAccuracyAuthorization.Unknown so that collection still reaches the provider's guarded update path, which retries the allocation and reports a persistent failure as 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.

Link copied to clipboard

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