Package com.google.maps.android.location
Class FusedLocationProviderKt
-
- All Implemented Interfaces:
public final class FusedLocationProviderKt
-
-
Method Summary
Modifier and Type Method Description final static Flow<Location>locationEvents(FusedLocationProviderClient $self, LocationRequest locationRequest, Looper looper)Returns a cold flow that emits device location updates using FusedLocationProviderClient.requestLocationUpdates. final static Flow<Location>fusedLocationEvents(FusedLocationProviderClient $self, Long intervalMs, Float minUpdateDistanceM, Integer priority, Looper looper)Simplified helper returning a cold flow that emits device location updates from FusedLocationProviderClient. -
-
Method Detail
-
locationEvents
@RequiresPermission(anyOf = {"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}) final static Flow<Location> locationEvents(FusedLocationProviderClient $self, LocationRequest locationRequest, Looper looper)
Returns a cold flow that emits device location updates using FusedLocationProviderClient.requestLocationUpdates.
The location updates start streaming ONLY when the flow is collected, and stop streaming immediately when the collector cancels or closes the subscription.
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 callback completely. Always share this flow (e.g. using kotlinx.coroutines.flow.shareIn) for multi-observer configurations.
- Parameters:
locationRequest- The LocationRequest specifying the quality of service (e.g.looper- The Looper on which the callback runs.
-
fusedLocationEvents
@RequiresPermission(anyOf = {"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}) final static Flow<Location> fusedLocationEvents(FusedLocationProviderClient $self, Long intervalMs, Float minUpdateDistanceM, Integer priority, Looper looper)
Simplified helper returning a cold flow that emits device location updates from FusedLocationProviderClient.
- Parameters:
intervalMs- The desired interval for location updates in milliseconds.minUpdateDistanceM- The minimum distance between location updates in meters.priority- The location priority accuracy mode.looper- The Looper on which the callback runs.
-
-
-
-