Skip to main content

Location simulation

UX Framework provides the ability to simulate location for debug purposes. It might be useful when you need to test your application in a particular location, but have no ability to simulate location. Once you enable location simulation it allows you to specify a default location, manage simulated location on UI and simulate navigation along the route.

Note
Enabled Location Simulation does not allow you to use another location provider simultaneously.

There are two ways of simulating location and routes:

To enable location simulation you must enable it by passing showSimulateLocationOption = true in debugSettings. See the code block below for reference and learn more about debug settings in the DashDebugSettingsConfigInit. Once enabled, the "Testing Tools" menu of the app will now include "Simulate Location".

Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
debugSettings {
showSimulateLocationOption = true
}
}

When the "Simulate Location" option is enabled in the app:

  • During navigation sessions, the location is automatically simulated along the route.
  • To manually change the location, long-press on the map to teleport to a new location.

Default location simulation

To turn on location simulation mode you will need to enable it through the configuration and specify a coordinate as default location for the simulation mode.

Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
locationSimulation {
defaultLocation = Location(LocationManager.PASSIVE_PROVIDER).apply {
latitude = 38.899929
longitude = -77.03394
}
}
}
Was this page helpful?