You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(location): unify LocationManager.asLocationSource() fallback and permission semantics across Android and iOS #1818
In the initial multiplatform LocationSource implementation (#1817) and the maps-compose-multiplatform-demo integration (googlemaps/android-maps-compose#1038), iOS callers can create a LocationSource with a single call (manager.asLocationSource()), whereas Android callers currently need extra wrapper logic around LocationManager to handle cached fixes, indoor fallback, and Android 12+ coarse-only permissions.
Proposed Enhancements
Built-in Cached Fix & Coarse Fallback in LocationManager.asLocationSource() (androidMain):
Emit the freshest cached location across GPS_PROVIDER, NETWORK_PROVIDER, and PASSIVE_PROVIDER (each wrapped in try / catch (_: SecurityException)) when collection begins, matching CLLocationManager.startUpdatingLocation() on iOS.
For LocationPriority.HIGH_ACCURACY, merge fineLocationEvents (GPS_PROVIDER) and coarseLocationEvents (NETWORK_PROVIDER). Because fineLocationEvents catches SecurityException and closes cleanly when only ACCESS_COARSE_LOCATION ("Approximate" location on Android 12+) is granted, merging the two allows LocationManager.asLocationSource() to:
Automatically degrade to NETWORK_PROVIDER when the user grants "Approximate" location instead of "Precise".
Deliver indoor network fixes while waiting for a GPS satellite lock.
Close cleanly if neither fine nor coarse permission is granted.
This reduces Android LocationSource creation in consumer apps to a single line (manager.asLocationSource()), matching iOS.
Automatic Authorization Prompt on kCLAuthorizationStatusNotDetermined in CLLocationManager.locationEvents() (iosMain):
When authorizationStatus == kCLAuthorizationStatusNotDetermined, invoke requestWhenInUseAuthorization() before startUpdatingLocation() so collecting the flow on iOS triggers the system permission prompt and begins emitting as soon as the user grants permission.
Provide a reusable @Composable permission/location helper using LifecycleEventEffect(Lifecycle.Event.ON_RESUME) and ActivityResultContracts.RequestMultiplePermissions on Android alongside CLLocationManagerDelegateProtocol.locationManagerDidChangeAuthorization on iOS.
Activity
docs(location): add TODOs referencing #1818 for unified LocationSourc…
feat(location): add multiplatform Location, LocationSource, and iOS C…