SystemLocationDataSource

A type of LocationDataSource that requests location updates from the Android platform's location API.

The Android framework's LocationManager is used to select one or more LocationProviders based on the parameters passed to the constructor. If both the GPS and the network location providers are disabled, then the AndroidLocationDataSource will fail to start and an IllegalStateException will be returned from LocationDataSource.error.

To use this class, the app must declare Location permissions in the manifest and must be granted Location permissions in the Android platform settings. The data source will fail to start if ArcGISEnvironment.applicationContext is not set.

Since

200.0.0

See also

Constructors

Link copied to clipboard
constructor(criteria: Criteria? = null, userProvider: String? = null, minimumUpdateTimeMs: Long = 100, minimumUpdateDistance: Float = 0.0f)

Inherited properties

Link copied to clipboard
val error: StateFlow<Throwable?>

An error that describes a problem encountered while starting or running the LocationDataSource. This property is used to notify the user about errors that occur in LocationDataSource. Such errors are critical for LocationDataSource and will cause it stop. If LocationDataSource cannot be started, or it stopped after a successful start, this property will store information related to what caused LocationDataSource to stop.

Link copied to clipboard
val headingChanged: SharedFlow<Double>

Set the heading changed callback function for the location data source.

Link copied to clipboard
open val locationChanged: SharedFlow<Location>

A SharedFlow that emits location changes.

Link copied to clipboard

The current status of the location data source. The status indicates if the location data source is starting, started, stopping, stopped, and has failed to start.

Functions

Link copied to clipboard
fun requestLocationUpdates(criteria: Criteria? = null, provider: String? = null, minimumUpdateTimeMs: Long = 100, minimumUpdateDistance: Float = 0.0f): Result<Unit>

Changes the location update parameters to use the given provider and/or Criteria, minimum update frequency, and minimum location distance change. Applies only when this SystemLocationDataSource's status is LocationDataSourceStatus.Started.

Inherited functions

Link copied to clipboard
suspend fun start(): Result<Unit>

Starts the location data source asynchronously and prepares to begin receiving location updates.

Link copied to clipboard
suspend fun stop(): Result<Unit>

Stop the location data source asynchronously.