LocationProvider

This is an intentionally very limited abstraction over the various platform APIs for geolocation. It is specialized to the use case of maplibre-compose.

If you have a more general use case, prefer using the platform APIs directly or using a more powerful wrapper. In that case, you may want to provide your own LocationProvider implementation to unify the API underneath. This is an explicitly supported use case: permission defaults to granted, so a source where permission is not a concept needs no permission handling.

Each collector of updates starts an independent platform location request. Cancelling collection must stop that request and unregister its callbacks.

Inheritors

Properties

Link copied to clipboard

Whether this provider has a usable platform implementation.

Link copied to clipboard
open val backendId: String?

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

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

Current foreground location permission.

Functions

Link copied to clipboard

Starts a foreground permission request and returns immediately.

Link copied to clipboard
abstract fun updates(request: LocationRequest): Flow<LocationEvent>

Returns a cold stream of foreground location updates.