feat(location-flow): add LocationManager and clustering Flow extensions#391
Open
dkhawk wants to merge 1 commit into
Open
feat(location-flow): add LocationManager and clustering Flow extensions#391dkhawk wants to merge 1 commit into
dkhawk wants to merge 1 commit into
Conversation
…oarse and fine location
- Implemented LocationManager.coarseLocationEvents() to stream coarse location updates from NETWORK_PROVIDER (fallback to PASSIVE_PROVIDER) using callbackFlow.
- Implemented LocationManager.fineLocationEvents() to stream fine location updates from GPS_PROVIDER using callbackFlow.
- Decorated both extensions with @RequiresPermission to enforce ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION system permissions.
- Handled full LocationListener interface overrides to ensure robust backward compatibility for minSdkVersion 23.
- Ensured location updates start only when the flow is collected and clean up immediately using awaitClose { removeUpdates(listener) } when the collector cancels.
- Authored robust unit tests inside LocationManagerTest.kt verifying correct registration, event emission, and cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces comprehensive Kotlin Flow extensions to the
maps-utils-ktxlibrary, adding modern reactive APIs for both marker/clustering collections and device location streaming.This branch is based on the core Flow extensions work and adds LocationManager tracking features.
1. LocationManager Flow Extensions 🗺️📍
Exposed two new subscriber-driven Flow APIs on
LocationManagerfor streaming device coordinates:coarseLocationEvents(): Streams fromNETWORK_PROVIDER(falls back toPASSIVE_PROVIDER) with@RequiresPermission(Manifest.permission.ACCESS_COARSE_LOCATION).fineLocationEvents(): Streams precise satellite positioning fromGPS_PROVIDERwith@RequiresPermission(Manifest.permission.ACCESS_FINE_LOCATION).removeUpdates) immediately when collectors cancel or close.LocationListenercallbacks to ensure complete compatibility withminSdkVersion 23.2. Cluster & Shape Collection Flow Extensions 📦
Added clean Flow wrappers for all major listener callbacks in utility managers:
ClusterManager:clusterClickEvents(),clusterItemClickEvents(),clusterInfoWindowClickEvents(),clusterInfoWindowLongClickEvents(),clusterItemInfoWindowClickEvents(), andclusterItemInfoWindowLongClickEvents().clickEvents()toMarkerManager.Collection(plus info window click/long-click flows),PolylineManager.Collection,PolygonManager.Collection,CircleManager.Collection, andGroundOverlayManager.Collection.3. Robust Asynchronous Unit Tests 🧪
Authored dedicated unit tests validating registration, flow event propagation, and cleanup:
Verification Status