Quickstart

VERSION 0.3.1106
PUBLIC PREVIEW

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

The Navigation SDK gives you a toolkit that allows you to bring a complete navigation experience to your application. It offers two modes of navigation: Turn-by-turn navigation and Free driving mode. This guide shows you how to set up the project to deploy basic navigation features on your emulator or device.

Project set up

Get your TomTom API key from the Developer Portal. You can find instructions on how to do this in the How to get TomTom API key document.

Next, configure the project as described in the Project setup guide.

Then add the Navigation module dependency in the build.gradle of your application module and synchronize the project.

1dependencies {
2 def version = "0.3.1106"
3 implementation "com.tomtom.sdk.navigation:navigation$version"
4}

Creating the TomTomNavigation object

You can start using navigation in the application by initializing the NavigationConfiguration. It requires four parameters:

  • context - This initializes Android dependencies.
  • apiKey - This is the TomTom API key.
  • locationProvider - The LocationProvider used by navigation to receive user location updates. See the Built-in location providers documentation and the Location module Quickstart for more information.
  • routeReplanner - This is the RouteReplanner that will be used for replanning the route.
1val locationProvider = GmsLocationProvider(this)
2val onlineRoutePlanner = OnlineRoutePlanner.create(this, "YOUR_API_KEY")
3val defaultRoutePlanner = DefaultRouteReplanner.create(onlineRoutePlanner)
4val guidanceEngine = GuidanceEngineFactory.createStaticGuidanceEngine(this, GuidanceEngineOptions())
5val navigationConfiguration = NavigationConfiguration(
6 context = applicationContext,
7 apiKey = "YOUR_API_KEY",
8 locationProvider = locationProvider,
9 routeReplanner = defaultRoutePlanner,
10 guidanceEngine = guidanceEngine
11)

If NavigationConfiguration is initialized, you can create the TomTomNavigation object. TomTomNavigation is responsible for interacting with and customizing navigation.

TomTomNavigation is used to:

  • Start navigation.
  • Stop navigation.
  • Update the route plan.
  • Get an instance or replace engines.
  • Set and remove different action listeners.
val navigation = TomTomNavigation.create(navigationConfiguration)

Starting navigation

Call the TomTomNavigation.start() method to start processing data.

tomTomNavigation.start()

Once you start the navigation session, TomTomNavigation will:

  • Request locations from the LocationProvider.
  • Process the incoming locations and send out various events with modified data, such as map-matched locations.
  • Send out guidance events once navigation has started with the route.

You can find more information on how to use navigation in the Turn-by-turn and Free driving guides.

center

Next steps

Since you have learned how to start using the Navigation SDK, here are recommendations for the next steps: