FusedLocationProvider

Foreground fused location from Huawei Mobile Services.

Delivers the last known location when available, then applies the requested accuracy, interval, and minimum distance. LocationAccuracy.Lowest receives passive updates.

Unavailable locations report LocationUnavailableReason.TemporarilyUnavailable. Missing permission reports LocationUnavailableReason.PermissionDenied. Other exceptions propagate to the collector.

The Context constructor handles permission requests. The FusedLocationProviderClient constructor reports permission as granted and requires the caller to manage authorization.

Create the provider, request permission, and close it on the main thread.

Constructors

Link copied to clipboard
constructor(locationClient: FusedLocationProviderClient)

Creates a provider backed by locationClient.

constructor(context: Context)

Creates a provider with its own fused client and an AndroidLocationProvider as its permission delegate.

Properties

Link copied to clipboard
open override 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
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
open override fun updates(request: LocationRequest): Flow<LocationEvent>