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, minDistance: Length, desiredAccuracy: DesiredAccuracy, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)) : LocationProvider

A LocationProvider built on the LocationManager platform APIs.

Link copied to clipboard
class AndroidOrientationProvider(context: Context, updateInterval: Duration, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)) : OrientationProvider

A OrientationProvider built on the SensorManager platform APIs.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class BearingWithAccuracy(val value: Bearing, val accuracy: Rotation?)

Represents a bearing value with its potential accuracy.

Link copied to clipboard

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

Link copied to clipboard
class IosLocationProvider(minDistance: Length, desiredAccuracy: DesiredAccuracy, enableLocation: Boolean, enableOrientation: Boolean, orientationUpdateInterval: Duration, coroutineScope: CoroutineScope, sharingStarted: SharingStarted) : LocationProvider, OrientationProvider

A LocationProvider built on the CLLocationManager platform APIs.

Link copied to clipboard
@Serializable
data class Location(val position: PositionWithAccuracy, val speed: SpeedWithAccuracy? = null, val course: BearingWithAccuracy? = null, 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
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
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
@Serializable
data class Orientation(val orientation: BearingWithAccuracy? = null, val timestamp: TimeMark)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Serializable
data class PositionWithAccuracy(val value: Position, val accuracy: Length?)

Represents a geographical position with an associated accuracy.

Link copied to clipboard
@Serializable
data class SpeedWithAccuracy(val distancePerSecond: Length, val accuracy: Length?)

Represents a speed value with its potential accuracy.

Link copied to clipboard

Functions

Link copied to clipboard
fun CLLocation.asMapLibreLocation(): Location
Link copied to clipboard
fun LocationPuck(idPrefix: String, location: Location?, cameraState: CameraState, bearing: BearingWithAccuracy? = location?.course, 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
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

Returns the most accurate bearing measurement available.

Link copied to clipboard
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
fun rememberAndroidLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistance: Length, 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
fun rememberAndroidOrientationProvider(updateInterval: Duration, context: Context = LocalContext.current, coroutineScope: CoroutineScope = rememberCoroutineScope(), sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)): AndroidOrientationProvider

Create and remember an AndroidOrientationProvider, the default OrientationProvider for Android

Link copied to clipboard
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistance: Length): LocationProvider

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

expect fun rememberDefaultLocationProvider(updateInterval: Duration = 1.seconds, desiredAccuracy: DesiredAccuracy = High, minDistance: Length = 1.meters): LocationProvider

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

actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistance: Length): LocationProvider

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

actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistance: Length): LocationProvider

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

actual fun rememberDefaultLocationProvider(updateInterval: Duration, desiredAccuracy: DesiredAccuracy, minDistance: Length): LocationProvider

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

fun rememberIosLocationAndOrientationProvider(minDistance: Length = 1.meters, desiredAccuracy: DesiredAccuracy = DesiredAccuracy.High, orientationUpdateInterval: Duration = 1.seconds, coroutineScope: CoroutineScope = rememberCoroutineScope(), sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)): IosLocationProvider

Create and remember an IosLocationProvider that uses one CLLocationManager for both location and orientation updates.

Link copied to clipboard
fun rememberIosLocationProvider(minDistance: Length = 1.meters, desiredAccuracy: DesiredAccuracy = DesiredAccuracy.High, enableLocation: Boolean = true, enableOrientation: Boolean = false, orientationUpdateInterval: Duration = 1.seconds, 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
fun rememberUserLocationState(locationProvider: LocationProvider, orientationProvider: OrientationProvider = rememberNullOrientationProvider(), samplePeriod: Duration = 1.seconds, lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current, minActiveState: Lifecycle.State = Lifecycle.State.STARTED, coroutineContext: CoroutineContext = EmptyCoroutineContext): UserLocationState

Remembers and returns a UserLocationState that can be used to track the user's location and device orientation.