Custom Location Data Source
A LocationDataSource that can be driven by a user-defined provider of location data. This can be useful if you have location data coming in from some custom source and you would like that data in the form of a LocationDataSource so that it can interface with other parts of the API.
This class will create an instance of LocationProvider using createLocationProvider when the data source is LocationDataSourceStatus.Starting. The resulting LocationProvider can be obtained from CustomLocationDataSource.currentProvider, which will be null when the data source is not LocationDataSourceStatus.Started. A new LocationProvider instance is created every time the data source is started.
Note that this API does not provide status updates to the LocationProvider. If you use a SharedFlow, be aware that it will continue emitting after the CustomLocationDataSource is stopped. The CustomLocationDataSource will stop collecting when CustomLocationDataSource.stop is called, at which point it will no longer be a subscriber to the SharedFlow. Refer to the official documentation of Flow and SharedFlow for more information on how to observe collectors from the emission source.
Since
200.0.0
See also
Types
An interface containing Flows through which you can provide location and heading updates to a CustomLocationDataSource.
Properties
The current LocationProvider which is providing locations and headings to this CustomLocationDataSource.
Inherited properties
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.
Set the heading changed callback function for the location data source.
A SharedFlow that emits location changes.
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.