Class LocationManagerKt
-
- All Implemented Interfaces:
public final class LocationManagerKt
-
-
Method Summary
Modifier and Type Method Description final static Flow<Location>coarseLocationEvents(LocationManager $self, Long minTimeMs, Float minDistanceM, Looper looper)Returns a cold flow that emits the device's coarse location updates using LocationManager.NETWORK_PROVIDER. final static Flow<Location>fineLocationEvents(LocationManager $self, Long minTimeMs, Float minDistanceM, Looper looper)Returns a cold flow that emits the device's fine location updates using LocationManager.GPS_PROVIDER. -
-
Method Detail
-
coarseLocationEvents
@RequiresPermission(value = "android.permission.ACCESS_COARSE_LOCATION") final static Flow<Location> coarseLocationEvents(LocationManager $self, Long minTimeMs, Float minDistanceM, Looper looper)
Returns a cold flow that emits the device's coarse location updates using LocationManager.NETWORK_PROVIDER.
The location updates start streaming ONLY when the flow is collected, and stop streaming immediately when the collector cancels or closes the subscription. When the underlying location provider is unavailable or disabled, the flow completes normally.
Warning: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing multiple collectors will result in listener hijacking, and cancelling any observer will unregister the active listener completely. Always share this flow (e.g. using kotlinx.coroutines.flow.shareIn) for multi-observer configurations.
-
fineLocationEvents
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION") final static Flow<Location> fineLocationEvents(LocationManager $self, Long minTimeMs, Float minDistanceM, Looper looper)
Returns a cold flow that emits the device's fine location updates using LocationManager.GPS_PROVIDER.
The location updates start streaming ONLY when the flow is collected, and stop streaming immediately when the collector cancels or closes the subscription. When the underlying location provider is unavailable or disabled, the flow completes normally.
Warning: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing multiple collectors will result in listener hijacking, and cancelling any observer will unregister the active listener completely. Always share this flow (e.g. using kotlinx.coroutines.flow.shareIn) for multi-observer configurations.
-
-
-
-