LocationTrackingEffect

fun LocationTrackingEffect(locationState: LocationState, enabled: Boolean = true, trackBearing: Boolean = true, onLocationChange: suspend LocationChangeScope.() -> Unit)(source)

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

onLocationChange is called when LocationState.location changes. Course or device-orientation changes also trigger it when trackBearing is true.

If enabled is false, onLocationChange is never called. Disabling this effect stops observation but does not control LocationState's platform location request. Pass the same enabled state to rememberLocationState when those lifetimes should match.

Parameters

locationState

State to observe.

enabled

Whether callbacks are enabled.

trackBearing

Whether course or device-heading changes can trigger a callback.

onLocationChange

Callback with the previous and current measurements.