๐ Android Maps KTX Flow Snippets Catalog
June 30, 2026 ยท View on GitHub
This directory contains standalone code snippets demonstrating how to consume the newly added Kotlin Flow extensions inside the maps-utils-ktx library.
All snippets are enclosed in standard developer documentation region tags to make them easily importable into public guides, and are verified automatically via mock unit tests to prevent regressions.
๐ KTX Flow Snippet Status
| Feature | Status | Source Code | Visual Preview | Region Tag | Description |
|---|---|---|---|---|---|
| Fine Location Flow | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_fine_location | Streams high-precision device coordinate updates reactively using GPS, with an automatic start/stop subscriber lifecycle. |
| Coarse Location Flow | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_coarse_location | Streams coarse WiFi/Cell device coordinate updates reactively using network/passive providers, closing cleanly on setting disablement. |
| Cluster Clicks | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_cluster_clicks | Reactively streams click events on clustered groups of markers instead of overriding standard camera callbacks. |
| Cluster Item Clicks | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_cluster_item_clicks | Listens to individual marker click events within clusters. Demonstrates how to use .shareIn() to safely broadcast to multiple active observers. |
| Marker Collection Clicks | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_marker_collection_clicks | Listens to marker click events on separate styled collections managed by MarkerManager. |
| Circle Collection Clicks | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_circle_collection_clicks | Listens to circle click events on separate styled collections managed by CircleManager. |
| Map Init (Coroutines) | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_coroutines_init | Retrieves the GoogleMap instance safely inside a lifecycle-aware coroutine scope without legacy callback blocks. |
| Animate Camera (Coroutines) | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_coroutines_animate | Smoothly animates the map camera and suspends coroutine execution, resuming only after the animation fully completes. |
| Camera Idle Events Flow | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_flow_camera_events | Streams map camera stationary idle state changes dynamically via Flow. |
| Polygon Containment Check | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_utils_polygon_contains | Performs robust polygon bounds checking to see if a LatLng coordinate is contained inside. |
| GeoJSON Overlay Builder | โ Verified | Source Code (Activity) | ![]() | maps_android_ktx_utils_geojson | Dynamically parses and overlay a styled GeoJSON vector layer on top of the map view. |
๐งช Snippet Verification Testing
To ensure these snippets remain 100% correct and compile warning-free after library and dependency upgrades, they are covered by a dedicated unit test suite: ๐ SnippetVerificationTest.kt
You can execute these tests locally at any time:
./gradlew :app:test --tests "com.google.maps.android.ktx.demo.snippets.*"






