rememberLocation

fun rememberLocation(accuracy: LocationAccuracy = LocationAccuracy.BALANCED, distanceFilter: Double = 10.0, updateInterval: Long): LocationState

Reactively use the current user Location (the equivalent of VisionCamera's useLocation).

Location updates start once the permission is granted and stop when this leaves the composition.

val location = rememberLocation()

LaunchedEffect(location.hasPermission) {
if (!location.hasPermission) location.requestPermission()
}

location.currentLocation?.let { println("At ${it.latitude}, ${it.longitude}") }

Parameters

accuracy

The accuracy of location updates.

distanceFilter

The distance the last location has to change in order to fire a new location update, in meters.

updateInterval

The interval in which location updates are requested from the system, in milliseconds (Android only).


Reactively use the current user Location reported by the given locationManager (the equivalent of VisionCamera's useLocation).

Location updates start once the permission is granted and stop when this leaves the composition. The locationManager is not closed.