Skip to main content

Electric vehicle

The Navigation SDK UX Framework allows the integration of electric vehicle charging stations into route planning. To enable this feature, you need to specify ELECTRIC engine type and specify an EV data provider to allow the building of such routes.

To integrate EV data, the com.mapbox.dash.ev.api.EvDataProvider interface must be implemented. This interface offers a comprehensive set of EV properties, represented as kotlin.Flow:

val config = DashConfig.create(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
engineType = EngineType.ELECTRIC
val evDataProvider = object : EvDataProvider {
override val stateOfCharge = flowOf(50f)
override val minBatteryRange = flowOf<Float?>(200f)
override val maxBatteryRange = flowOf<Float?>(240f)
override val secondsRemainingToCharge = flowOf<Int?>(7200)
override val isChargerPluggedIn = flowOf(true)
override val maxCharge = flowOf(57500)
override val connectorTypes = flowOf("ccs_combo_type1")
override val energyConsumptionCurve = flowOf("0,300;20,160;80,140;120,180")
override val chargingCurve = flowOf("0,100000;40000,70000;60000,30000;80000,10000")

Each property of the data provider is detailed in the JavaDoc.

Real-time updates are also workable:

val newEvDataProvider = object : EvDataProvider {
// ...

While the example illustrates the EV data provider properties as single-shot Flows, they can dynamically represent the real-time properties of an electric vehicle.

Was this page helpful?