Custom location provider
In some cases, you might need to use your own source of location updates. For example, automotive OEMs may want to implement gathering GPS signals from an alternative hardware. In that case, you can build your custom location provider which must implement the LocationProvider
interface, and then wrap it in a factory. In the code, it may look like this:
Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
customLocationProviderFactoryConfig = CustomLocationFactoryProviderConfig.Builder(
LocationProviderFactory { _ ->
MyLocationProvider()
},
// The locations emitted by MyLocationProvider are real, so specify type REAL.
// If custom location provider is mocked or mixed, make sure it sets the correct isMock flag to mocked locations.
LocationProviderType.REAL,
).build()
}
Where MyLocationProvider
is the implementation of LocationProvider
.
Was this page helpful?