Package-level declarations

Types

Link copied to clipboard
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

A LocationProvider built on the LocationManager platform APIs.

Link copied to clipboard
Link copied to clipboard

Accuracy levels for rememberDefaultLocationProvider, which will be mapped to platform accuracy and power levels.

Link copied to clipboard
class IosLocationProvider(minDistanceMeters: Double, desiredAccuracy: DesiredAccuracy, coroutineScope: CoroutineScope, sharingStarted: SharingStarted) : LocationProvider

A LocationProvider built on the CLLocationManager platform APIs.

Link copied to clipboard
data class Location(val position: Position, val accuracy: Double, val bearing: Double?, val bearingAccuracy: Double?, val speed: Double?, val speedAccuracy: Double?, val timestamp: TimeMark)

Describes a user's location

Link copied to clipboard

Provides an easy mechanism to keep a map's org.maplibre.compose.camera.CameraState in sync with the current location via LocationTrackingEffect.

Link copied to clipboard
Link copied to clipboard
class LocationEngineLocationProvider @RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"]) constructor(locationEngine: LocationEngine, locationEngineRequest: LocationEngineRequest = defaultLocationEngineRequest, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)) : LocationProvider

A LocationProvider based on a LocationEngine implementation and a provided LocationEngineRequest.

Link copied to clipboard

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

Link copied to clipboard
@Immutable
class LocationPuckColors(val dotFillColorCurrentLocation: Color = Color.Companion.Blue, val dotFillColorOldLocation: Color = Color.Companion.Gray, val dotStrokeColor: Color = Color.Companion.White, val shadowColor: Color = Color.Companion.Black, val accuracyStrokeColor: Color = Color.Companion.Blue, val accuracyFillColor: Color = accuracyStrokeColor.copy(alpha = 0.3f), val bearingColor: Color = Color.Companion.Red)

Colors for LocationPuck

Link copied to clipboard
@Immutable
class LocationPuckSizes(val dotRadius: Dp = 6.dp, val dotStrokeWidth: Dp = 3.dp, val shadowSize: Dp = 3.dp, val shadowOffset: DpOffset = DpOffset(0.dp, 1.dp), val shadowBlur: Float = 1.0f, val accuracyStrokeWidth: Dp = 1.dp, val bearingSize: Dp = dotRadius)

Sizing parameters for LocationPuck

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun CLLocation.asMapLibreLocation(): Location
Link copied to clipboard
@Composable
fun LocationPuck(idPrefix: String, locationState: UserLocationState, cameraState: CameraState, oldLocationThreshold: Duration = 30.seconds, accuracyThreshold: Float = 50.0f, colors: LocationPuckColors = LocationPuckColors(), sizes: LocationPuckSizes = LocationPuckSizes(), showBearing: Boolean = true, showBearingAccuracy: Boolean = true, onClick: LocationClickHandler? = null, onLongClick: LocationClickHandler? = null)

Adds multiple layers to form a location puck.

Link copied to clipboard
@Composable
fun LocationTrackingEffect(locationState: UserLocationState, enabled: Boolean = true, trackBearing: Boolean = true, precision: Double = 1.0E-5, onLocationChange: suspend LocationChangeScope.() -> Unit)

A form of LaunchedEffect that is specialized for tracking user location.

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

Create and remember an AndroidLocationProvider, the default LocationProvider for Android

Link copied to clipboard
@Composable
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistanceMeters: Double): LocationProvider
@Composable
expect fun rememberDefaultLocationProvider(updateInterval: Duration = 1.seconds, desiredAccuracy: DesiredAccuracy = DesiredAccuracy.High, minDistanceMeters: Double = 1.0): LocationProvider

Create and remember a LocationProvider using the default implementation for the platform.

@Composable
actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistanceMeters: Double): LocationProvider
@Composable
actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistanceMeters: Double): LocationProvider
@Composable
actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistanceMeters: Double): LocationProvider
Link copied to clipboard
@Composable
fun rememberIosLocationProvider(minDistanceMeters: Double = 1.0, desiredAccuracy: DesiredAccuracy = DesiredAccuracy.High, coroutineScope: CoroutineScope = rememberCoroutineScope(), sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)): IosLocationProvider
Link copied to clipboard

Create and remember a LocationProvider that never provides a location.

Link copied to clipboard
@Composable
fun rememberUserLocationState(locationProvider: LocationProvider, lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current, minActiveState: Lifecycle.State = Lifecycle.State.STARTED, coroutineContext: CoroutineContext = EmptyCoroutineContext): UserLocationState