Repository navigation
feat(location): add multiplatform Location, LocationSource, and iOS CLLocationManager Flow helpers - #1817
Merged
Conversation
…LLocationManager Flow helpers
…usedLocationProvider.kt
Contributor
Code Coverage
Files
|
kikoso
reviewed
Oct 12, 2026
kikoso
left a comment
Collaborator
There was a problem hiding this comment.
Nice addition, and the typealias approach keeps the Android side really clean! Can you take a look at the comments, @dkhawk ? The permission one is the most important, since it changes the behaviour of APIs we already ship in 6.0.0.
… delegate - Android location flows fail with SecurityException again when location permission is missing, as in 6.0.0, instead of completing silently. - iOS locationEvents restores the delegate the manager had before collection, and documents the single-collector limitation. - iOS altitudeMeters reads ellipsoidalAltitude (WGS 84), matching Android's getAltitude(); CLLocation.altitude is above mean sea level.
kikoso
approved these changes
Oct 12, 2026
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.
Summary
Extends the
com.google.maps.android.locationpackage in:libraryto Kotlin Multiplatform (commonMain,androidMain, andiosMain):commonMain(Location.kt):expect class Locationwith multiplatform extension properties (latitude,longitude,accuracyMeters,altitudeMeters,bearingDegrees,speedMetersPerSecond,timestampMillis, andlatLng: LatLng).LocationPriority(HIGH_ACCURACY,BALANCED_POWER_ACCURACY,LOW_POWER) andfun interface LocationSourcereturning a coldFlow<Location>.kotlinx-coroutines-coretocommonMainapidependencies soFlow<Location>can be consumed directly in shared code.androidMain(Location.android.kt,LocationManager.kt,FusedLocationProvider.kt):actual typealias Location = android.location.Locationfor 100% source and binary compatibility with existing Android callers.LocationManager.asLocationSource()andFusedLocationProviderClient.asLocationSource()(kept inFusedLocationProvider.ktso consumers without the optionalplay-services-locationdependency do not encounter class-loading errors).SecurityExceptionincoarseLocationEvents,fineLocationEvents, andFusedLocationProviderClient.locationEventsby closing thecallbackFlowcleanly when permissions are missing or revoked at runtime.iosMain(Location.ios.kt):actual typealias Location = platform.CoreLocation.CLLocation.CLLocationManager.locationEvents(),coarseLocationEvents(),fineLocationEvents(), andasLocationSource()backed bycallbackFlowandCLLocationManagerDelegateProtocol.Testing
:library:testAndroidHostTest(LocationSourceTest,LocationManagerTest,FusedLocationProviderTest):library:iosSimulatorArm64Test(CLLocationManagerTest):library:apiCheck