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.

Parameters

locationState

State to observe.

enabled

Whether callbacks are enabled. If 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.

trackBearing

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

onLocationChange

Callback with the previous and current measurements. It is called when LocationState.lastLocation changes. Course or device-heading changes also trigger it when trackBearing is true.