Route simulation

VERSION 0.3.34

Navigation SDK for Android is only available upon request. Contact us to get started.

Navigation functionality depends on knowing the user’s location. Location updates are provided by the LocationEngine. To obtain user location, you can use the Built-in Location Engines or implement your own.

Location updates along a route can also be simulated for testing purposes. To use the LocationEngine that provides simulated locations, add the following dependency in the module’s build.gradle.

1dependencies {
2 implementation "com.tomtom.sdk:location-simulation:0.3.34"


The SimulationLocationEngine simulates location updates using the provided list of locations. It implements the LocationEngine interface. To define the strategy for generating location updates a SimulationStrategy has to be provided to the constructor.

val timestampStrategy = TimestampStrategy(locations = locations)
val simulationLocationEngine = SimulationLocationEngine.create(timestampStrategy)


SimulationLocationEngine requires a SimulationStrategy that determines how location updates should occur.

Two predefined strategies are available: InterpolationStrategy and TimestampStrategy. You can also create a custom strategy for providing simulated locations. To do this, implement the SimulationStrategy interface. The interface contains two methods:


InterpolationStrategy uses interpolation to determine a simulated position.

It should be used if the successive locations are not close enough together. The main use case of this strategy is simulating from a route, because the coordinates are too far away from each other for smooth rendering.

To create an InterpolationStrategy object, provide a list of GeoLocations that will be used during simulation. The rest of the parameters are optional. You can specify the delay after the first position is provided and the delay before the provision of each subsequent location. You can also define the speed of the moving object in meters per second.

1val interpolationStrategy = InterpolationStrategy(
2 locations = locations,
3 startDelay = Duration.ofSeconds(1),
4 broadcastDelay = Duration.ofMilliseconds(500),
5 currentSpeedInMetersPerSecond = 13.0


TimestampStrategy calculates the delay between simulated locations based on the differences between GeoLocation.times in consecutive locations. This strategy is useful if you are using previously recorded traces, where the consecutive locations are closer to each other than for a route.

Location simulation based on the TimestampStrategy only works if the timestamps of the sequence of GeoLocations are valid.

To create this object, provide a list of GeoLocation objects.

1val timestampStrategy = TimestampStrategy(
2 locations = locations

Changing navigation location engines

The LocationEngine used for navigation is initially specified using the NavigationConfiguration object. However, you can change the engine responsible for location updates at any time. For example, you can switch to simulated locations even if the navigation was started with the user location.

1val timestampStrategy = TimestampStrategy(locations = locations)
2val simulationLocationEngine = SimulationLocationEngine.create(timestampStrategy)