Route emulation (v2.1.x - Android)
It’s possible to emulate route navigation for demonstration purposes using the RouteEmulator
object returned from the Sdk.getRouteEmulator()
method.
To start emulation, first calculate a route, then pass it to the startEmulation()
method. To change the speed used for the emulation, use the setRequiredSpeed()
method and to stop it, use stopEmulation()
.
Using the addListener()
method, a listener can also be added to receive notifications when route emulation starts or ends.
Example:
private final RouteEmulator.Listener routeEmulatorListener = new RouteEmulator.Listener() {
@Override
public void onEmulationStarted() {
Toast.makeText(
activity,
"Route emulation started",
Toast.LENGTH_SHORT).show();
}
@Override
public void onEmulationFinished() {
Toast.makeText(
activity,
"Route emulation finished",
Toast.LENGTH_SHORT).show();
}
};
RouteEmulator routeEmulator = sdk.getRouteEmulator();
routeEmulator.addListener(routeEmulatorListener);
routeEmulator.startEmulation(calculatedRoute, 65);