Quickstart

VERSION 0.12.0
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.12.0"
3 implementation "com.tomtom.sdk.navigation:navigation-online:$version"
4}

Creating the TomTomNavigation object

You can start using navigation in the application by initializing the TomTomNavigation. The initialization is made via the TomTomNavigationFactory. It has the following methods for creating the online TomTomNavigation:

Be advised that navigation will fetch the vehicle’s data from the VehicleProvider that was set in NavigationConfiguration.

The minimal required parameters are:

  • context - This initializes Android dependencies.
  • apiKey - 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.
  • routePlanner - This is the RoutePlanner that will be used for routing requests during replanning.
1val locationProvider = GmsLocationProvider(this)
2val onlineRoutePlanner = OnlineRoutePlanner.create(this, "YOUR_API_KEY")
3val tomTomNavigation = TomTomNavigationFactory.createOnlineNavigation(
4 applicationContext,
5 "YOUR_API_KEY",
6 locationProvider,
7 onlineRoutePlanner
8)

TomTomNavigation is used to:

  • Start navigation.
  • Stop navigation.
  • Update the route plan.
  • Get an instance or replace engines.
  • Set and remove different action listeners.

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: