BrowserLocationProvider

Foreground location from the browser's Geolocation API.

LocationAccuracy.BestForNavigation and LocationAccuracy.High request high accuracy. Applies LocationRequest.minimumInterval and ignores LocationRequest.minimumDistance.

A missing Geolocation API reports LocationBackendAvailability.Unsupported. Permission denial reports LocationUnavailableReason.PermissionDenied and updates permission. Timeouts and unavailable positions report LocationUnavailableReason.TemporarilyUnavailable. Failure to start location updates reports LocationUnavailableReason.UnexpectedFailure.

Constructors

Link copied to clipboard
constructor(coroutineScope: CoroutineScope)

Creates a provider that observes permission in coroutineScope.

Properties

Link copied to clipboard

Whether this provider has a usable platform implementation, stable for its lifetime.

Link copied to clipboard
open val backendId: String?

A stable implementation name for diagnostics, when the provider declares one.

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

Current foreground location permission.

Functions

Link copied to clipboard
open override fun close()

Releases resources owned by this provider. Repeated calls have no effect.

Link copied to clipboard
open override fun requestPermission()

Starts a foreground permission request and returns immediately.

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

Returns a cold stream of foreground location updates.