Navigation visualization

VERSION 0.3.344
PUBLIC PREVIEW

You can use the Navigation Visualization add-on to provide users with a basic navigation experience by visualizing navigation features such as routes and guidance.

Project set up

  1. Configure the project as described in the Project setup guide.
  2. Add the Navigation Visualization add-on dependency in the build.gradle of your application module and synchronize the project.
    1dependencies {
    2 implementation "com.tomtom.sdk:addons.visualization.navigation:0.3.344"
    3}

Creating a Navigation Visualization entry point

Use the NavigationVisualizationFactory.create method to create the NavigationVisualization object. It takes three arguments:

  1. tomTomMap: a TomTomMap object.
  2. navigationControler: a NavigationController object.
  3. styleConfiguration: an optional StyleConfiguration object. If no object is provided, the default style configuration is used.
val navigationVisualization = NavigationVisualizationFactory.create(tomTomMap, navigationControler)
val navigationVisualization = NavigationVisualizationFactory.create(tomTomMap, navigationControler, styleConfiguration)

Displaying routes

Use displayRoutePlan to display a RoutePlan:

navigationVisualization.displayRoutePlan(routePlan)

By default, the first Route is selected, and all others are marked as alternatives.

center

Which Route is selected can be changed by using selectRoute method. This method takes a Route object that is part of the displayed RoutePlan as an argument.

navigationVisualization.selectRoute(route)

Displaying the selected route during navigation

Once NavigationController.start is called to start the navigation session, the selected Route becomes the active Route. During its lifecycle, the NavigationVisualization object subscribes to different navigation events in order to display information about route progress.

The navigation session is stopped by calling the NavigationController.stop method.

center