Safety locations

VERSION 1.13.0
PUBLIC PREVIEW

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

Before you start check: Starting navigation guide

Project setup

  1. Before proceeding with this guide, follow the Quickstart guide for Maps and Quickstart guide for Navigation to create the TomTomMap and TomTomNavigation objects, which are essential for use with the Navigation Visualization module responsible for displaying Safety Locations during navigation session.
  2. Add the Navigation Visualization dependency in the build.gradle of your application module and synchronize the project:
    implementation("com.tomtom.sdk.maps.visualization:navigation:1.13.0")
  3. Use the NavigationVisualizationFactory.create method to create the NavigationVisualization object:
    navigationVisualization =
    NavigationVisualizationFactory.create(tomTomMap, tomtomNavigation)

To visualize Safety Locations the SafetyLocationsConfiguration should be set when configuring TomTomNavigation. SafetyLocationsConfiguration need to be created with an API key for the Safety Locations API. Check the Horizon safety locations guide.

safety locations visualization

Safety location types

safety location types

By default all SafetyLocationTypes are enabled. You can hide specified types of safety locations by using configuration API:

navigationVisualization.safetyLocationVisualization.hideSafetyLocations(hiddenSafetyLocations)

Speed and danger zones on route

Speed and danger zones are represented on the route as a tube with an outline. Both of them have a “Start Marker” that indicates beginning of the zone and an “End Marker” containing information about the end of the zone.

Speed zone

speed zone

Danger zone

danger zone

Safety locations style customization

During the creation of NavigationVisualization through the NavigationVisualizationFactory.create, StyleConfiguration can be passed in to define custom stylization. By default, if it’s not passed in, the default style will be used. To define a custom stylization for safety locations, see SafetyLocationStyle. The custom style object can be passed as:

1navigationVisualization =
2 NavigationVisualizationFactory.create(
3 tomTomMap,
4 tomtomNavigation,
5 styleConfiguration = StyleConfiguration(safetyLocationStyle = customSafetyLocationStyle),
6 )

Learn more

Since you have learned how to set up Safety locations, here are recommendations for the next steps: