AndroidLocationProvider

class AndroidLocationProvider @RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"]) constructor(context: Context, updateInterval: Duration, minDistanceMeters: Float, desiredAccuracy: DesiredAccuracy, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)) : LocationProvider(source)

A LocationProvider built on the LocationManager platform APIs.

The LocationManager.PASSIVE_PROVIDER will be used for DesiredAccuracy.Lowest, otherwise an appropriate provider and configuration is chosen based on API level and desiredAccuracy.

Parameters

context

the Context get the LocationManager system service from

updateInterval

the minimum time between location updates

desiredAccuracy

the DesiredAccuracy for location updates.

coroutineScope

the CoroutineScope used to share the location flow

sharingStarted

parameter for stateIn call of location

Throws

if the necessary platform permissions have not been granted

Constructors

Link copied to clipboard
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
constructor(context: Context, updateInterval: Duration, minDistanceMeters: Float, desiredAccuracy: DesiredAccuracy, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000))

Properties

Link copied to clipboard
open override val location: StateFlow<Location?>