/tripkit/TripKitAndroidUIData/com.skedgo.tripkit.ui.data.location/RxFusedLocationProviderClient

RxFusedLocationProviderClient

\ open class RxFusedLocationProviderClient(client: FusedLocationProviderClient)

Reactive wrapper around FusedLocationProviderClient exposing location updates as RxJava Flowables and Kotlin Flows.

removeLocationUpdates is async, so GMS may still deliver callbacks after disposal. The RxJava path guards against this with an AtomicBoolean cancellation flag; the Flow path relies on callbackFlow/awaitClose where trySend on a closed channel is already a safe no-op.

Constructors

RxFusedLocationProviderClient constructor(client: FusedLocationProviderClient)

Types

Name Summary
Companion object Companion

Functions

Name Summary
getLastLocation open fun getLastLocation(): Flowable<LastLocation>
Emits the most recent known location as LastLocation.Available, or LastLocation.NotAvailable when no cached fix exists.
requestLocationStream open fun requestLocationStream(request: LocationRequest): Observable<Location>
Projects requestLocationUpdates to raw Location objects, discarding availability events. Subscribes on IO, observes on the main thread.
requestLocationStreamFlow open fun requestLocationStreamFlow(request: LocationRequest): Flow<Location>
Flow counterpart of requestLocationStream; emits non-null Location values only.
requestLocationUpdates open fun requestLocationUpdates(request: LocationRequest): Flowable<LocationUpdates>
Streams LocationUpdates via FusedLocationProviderClient.requestLocationUpdates. Disposing the subscription calls removeLocationUpdates and sets an AtomicBoolean cancellation flag before the removal request, so any in-flight GMS callbacks arriving during the async removal window are silently dropped.
requestLocationUpdatesFlow open fun requestLocationUpdatesFlow(request: LocationRequest): Flow<LocationUpdates>
Flow-based equivalent of requestLocationUpdates. awaitClose ensures removeLocationUpdates is called on cancellation; stale callbacks after removal are silently dropped via trySend on a closed channel.