AndroidLocationProvider
A LocationProvider built on the LocationManager platform APIs.
Each collection selects a provider and request settings from LocationRequest, emits the last known location when one exists, and removes its listener when collection ends.
On Android 12 and newer, LocationAccuracy.BestForNavigation and LocationAccuracy.High map to LocationRequest.QUALITY_HIGH_ACCURACY, LocationAccuracy.Balanced maps to LocationRequest.QUALITY_BALANCED_POWER_ACCURACY, and LocationAccuracy.Low maps to LocationRequest.QUALITY_LOW_POWER. Earlier versions use the corresponding Criteria accuracy and power requirements. LocationAccuracy.Lowest uses LocationManager.PASSIVE_PROVIDER on every version.
A disabled location service or LocationListener.onProviderDisabled maps to LocationUnavailableReason.ServicesDisabled. A SecurityException maps to LocationUnavailableReason.PermissionDenied. An IllegalArgumentException while registering the selected provider maps to LocationUnavailableReason.UnexpectedFailure, because this provider constructs and validates every request argument itself.
permission and requestPermission delegate to an AndroidLocationPermissionRequester; see its documentation for when the system permission dialog can be shown.
Parameters
Context used to obtain the platform LocationManager.
Permission requester that backs permission and requestPermission.
Constructors
Creates a provider with its own AndroidLocationPermissionRequester.
Properties
Functions
Starts a foreground permission request and returns immediately.
Returns a cold stream of foreground location updates.