MacosLocationProvider

A LocationProvider built on CLLocationManager.

LocationProvider.permission and LocationProvider.requestPermission delegate to a MacosLocationPermissionRequester that shares the provider's Core Location client.

Each collection creates a CLLocationManager on the AppKit main run loop, applies the request's accuracy and distance preferences, and stops the manager when collection ends. Compose Desktop's Dispatchers.Main is the Swing event-dispatch thread on the AWT host and does not pump that run loop, so Core Location work is marshaled there explicitly. The process's app Info.plist must declare NSLocationWhenInUseUsageDescription. LocationRequest.minimumInterval is ignored because Core Location filters only by distance.

LocationAccuracy.BestForNavigation maps to kCLLocationAccuracyBestForNavigation, LocationAccuracy.High maps to kCLLocationAccuracyBest, LocationAccuracy.Balanced maps to kCLLocationAccuracyHundredMeters, LocationAccuracy.Low maps to kCLLocationAccuracyKilometer, and LocationAccuracy.Lowest maps to kCLLocationAccuracyReduced.

kCLErrorDenied maps to LocationUnavailableReason.ServicesDisabled when location services are disabled and to LocationUnavailableReason.PermissionDenied otherwise. kCLErrorPromptDeclined also maps to LocationUnavailableReason.PermissionDenied. kCLErrorLocationUnknown and kCLErrorNetwork map to LocationUnavailableReason.TemporarilyUnavailable. Other Core Location errors map to LocationUnavailableReason.UnexpectedFailure.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
open val backendId: String?
Link copied to clipboard
open override val permission: StateFlow<LocationPermission>

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun requestPermission()
Link copied to clipboard
open override fun updates(request: LocationRequest): Flow<LocationEvent>