Integrate TomTom IndiGO into a Gradle Project (NavKit2)
This page is applicable only for TomTom IndiGO version 1.0.3880-1630 and earlier.
This pages contains the steps required to integrate the TomTom IndiGO platform into an existing Android Gradle project. If you are new to TomTom IndiGO, our recommendation is to use the examples as a starting point as these examples already cover the steps described on this page. Use the steps on this page as a reference to integrate the TomTom IndiGO platform into an existing / newly created Android Gradle project. These steps assume a basic level of experience with setting up Gradle build files using Kotlin.
Maven repositories
Gradle will need to be able to download TomTom IndiGO platform dependencies from TomTom's Maven repositories for which login credentials are required. These can be obtained from TomTom.
Access to these repositories can be configured in Gradle as follows:
1pluginManagement {2 repositories {3 // Local artifact cache.4 mavenLocal()56 // TomTom IndiGO's Nexus repository.7 maven("https://repo.tomtom.com/repository/ivi") {8 credentials {9 username =10 if (extra.has("nexusUsername")) extra["nexusUsername"].toString() else ""11 password =12 if (extra.has("nexusPassword")) extra["nexusPassword"].toString() else ""13 }14 }1516 // External repositories.17 mavenCentral()18 google()19 maven("https://plugins.gradle.org/m2/")20 }21}2223dependencyResolutionManagement {24 repositories {25 // Local artifact cache.26 mavenLocal()2728 // TomTom IndiGO's Nexus repository.29 maven("https://repo.tomtom.com/repository/ivi") {30 credentials {31 username =32 if (extra.has("nexusUsername")) extra["nexusUsername"].toString() else ""33 password =34 if (extra.has("nexusPassword")) extra["nexusPassword"].toString() else ""35 }36 }3738 // TomTom's Nexus repository for the Connectivity Agent.39 maven("https://maven.tomtom.com:8443/nexus/content/repositories/releases/")4041 // External repositories.42 mavenCentral()43 google()44 maven("https://plugins.gradle.org/m2/")45 }46}
The above needs to be applied to buildscript
, buildSrc
and to all projects. As such, place the
above in a file called build-logic/repositories.gradle.kts
and apply this file in
the top-level settings.gradle.kts
file like:
apply(from = "build-logic/repositories.gradle.kts")
and in your buildSrc/settings.gradle.kts
file like:
apply(from = "../build-logic/repositories.gradle.kts")
Dependency management
The TomTom IndiGO platform publishes a version catalog which you can use to ensure your product
uses the same versions as used by the TomTom IndiGO platform. Create:
build-logic/indigodependencies.versioncatalog.gradle.kts
and add:
1enableFeaturePreview("VERSION_CATALOGS")23dependencyResolutionManagement {4 @Suppress("UnstableApiUsage")5 versionCatalogs {6 create("indigoDependencies") {7 val group = "com.tomtom.ivi.platform"8 val artifact = "dependencies-catalog"9 val version = "<TOMTOM-INDIGO-VERSION>"10 from("${group}:${artifact}:${version}")11 }12 }13}
Replace the <TOMTOM-INDIGO-VERSION>
with the TomTom IndiGO version you want to use.
Next apply this file in the top-level settings.gradle.kts
file and buildSrc/settings.gradle.kts
files.
BuildSrc dependencies
The TomTom IndiGO platform provides Gradle plugins for the build-time configuration of the TomTom
IndiGO platform. This allows you to, for example, include all of IndiGO's default frontends in your
product. To allow the Gradle plugins to be used in the Gradle projects it is required to add the
Gradle plugins as implementation
dependencies to the buildSrc
. The following adds these
dependencies:
buildSrc/build.gradle.kts
1dependencies {2 val indigoPlatformVersion = ...34 // Optional: Plugin to configure the TomTom API key at build-time.5 implementation("com.tomtom.ivi.appsuite.gradle.navkit2:api_appsuitedefaults_navkit2:$indigoPlatformVersion")67 // Mandatory: Plugin to configure the IVI application at build-time.8 implementation("com.tomtom.ivi.platform.gradle:api_framework_config:$indigoPlatformVersion")910 // Optional: Plugin for versioning the APK based on the Git repository information.11 implementation("com.tomtom.ivi.platform.gradle:api_tools_version:$indigoPlatformVersion")1213 // Optional: Plugin to use the default frontends and services from the TomTom IndiGO platform14 // and app suite.15 implementation("com.tomtom.ivi.product.gradle:api_productdefaults_core:$indigoPlatformVersion")1617 // Mandatory: For IVI services plugins.18 implementation(indigoDependencies.gradlePluginKsp)19}
Root project configuration
Apply the following plugins in the top-level build.gradle.kts
file to the root Gradle project:
1plugins {2 `kotlin-dsl`3 ...4 // Mandatory: For IVI service plugins.5 id("com.google.devtools.ksp") apply false6 // Mandatory: For configure the IVI application at build-time.7 id("com.tomtom.ivi.platform.framework.config")8 // Optional: Plugin for versioning the APK based on the Git repository information.9 id("com.tomtom.ivi.platform.tools.version")10}
In the same file, configure the TomTom IndiGO platform dependency source:
1ivi {2 dependencySource = IviDependencySource.Artifactory(Versions.INDIGO_PLATFORM)3}
Integrating TomTom IndiGO platform into the APK
To integrate the TomTom IndiGO platform into an APK, you can add the following to the
build.gradle.kts
of the project that builds the APK:
1plugins {2 // Optional: To use the default frontends and services from the TomTom IndiGO platform and app3 // suite.4 id("com.tomtom.ivi.product.defaults.core")56 // Optional: To configure the TomTom API key at build-time.7 id("com.tomtom.ivi.appsuite.navkit2.defaults.config")8}910ivi {11 application {12 enabled = true13 }14}
Customization of TomTom IndiGO platform and appsuite default frontends and services
The Gradle plugin applied in the example above id("com.tomtom.ivi.product.defaults.core")
enables all the default frontends, frontend extensions, menu items and IVI service hosts from the
TomTom IndiGO platform and app suite for default runtime deployment.
If you only want to apply defaults from the TomTom IndiGO platform without the appsuite default, you
can achieve this by only applying the id("com.tomtom.ivi.platform.defaults.core")
Gradle plugin.
Additionally, if you want to include a selection of the TomTom IndiGO Applications, you can apply
the Gradle plugins for each individual TomTom IndiGO Application.
To allow these Gradle plugins to be used in the Gradle projects it is required to add the Gradle
plugins as implementation
dependencies to the buildSrc
. The following adds these dependencies:
1dependencies {2 val indigoPlatformVersion = ...34 // Optional: Plugin to configure in the default frontends and services from the TomTom IndiGO platform.5 implementation("com.tomtom.ivi.platform.gradle:api_defaults_core:$indigoPlatformVersion")6 // Optional: Plugin to configure in the defaults from NavKit2 TomTom IndiGO Application.7 implementation("com.tomtom.ivi.appsuite.gradle.navkit2:api_appsuitedefaults_navkit2:$indigoPlatformVersion")8 // Optional: Plugin to configure in the defaults from Media TomTom IndiGO Application.9 implementation("com.tomtom.ivi.appsuite.gradle.media:api_appsuitedefaults_media:$indigoPlatformVersion")10 // Optional: Plugin to configure in the defaults from Communications TomTom IndiGO Application.11 implementation("com.tomtom.ivi.appsuite.gradle.communications:api_appsuitedefaults_communications:$indigoPlatformVersion")12 // Optional: Plugin to configure in the defaults from User Profiles TomTom IndiGO Application.13 implementation("com.tomtom.ivi.appsuite.gradle.userprofiles:api_appsuitedefaults_userprofiles:$indigoPlatformVersion")14 // Optional: Plugin to configure in the defaults from Vehicle Settings TomTom IndiGO Application.15 implementation("com.tomtom.ivi.appsuite.gradle.vehiclesettings:api_appsuitedefaults_vehiclesettings:$indigoPlatformVersion")1617 // Optional: Plugin to configure in the defaults from App Store TomTom IndiGO Application.18 implementation("com.tomtom.ivi.appsuite.gradle.appstore:api_appsuitedefaults_appstore:$indigoPlatformVersion")19 // Optional: Plugin to configure in the defaults from Bluetooth TomTom IndiGO Application.20 implementation("com.tomtom.ivi.appsuite.gradle.bluetooth:api_appsuitedefaults_bluetooth:$indigoPlatformVersion")21 // Optional: Plugin to configure in the defaults from Companion TomTom IndiGO Application.22 implementation("com.tomtom.ivi.appsuite.gradle.companionapp:api_appsuitedefaults_companionapp:$indigoPlatformVersion")23 // Optional: Plugin to configure in the defaults from Hvac TomTom IndiGO Application.24 implementation("com.tomtom.ivi.appsuite.gradle.hvac:api_appsuitedefaults_hvac:$indigoPlatformVersion")25 // Optional: Plugin to configure in the defaults from Messaging TomTom IndiGO Application.26 implementation("com.tomtom.ivi.appsuite.gradle.messaging:api_appsuitedefaults_messaging:$indigoPlatformVersion")27 // Optional: Plugin to configure in the defaults from Navigation TomTom IndiGO Application.28 implementation("com.tomtom.ivi.appsuite.gradle.navigation:api_appsuitedefaults_navigation:$indigoPlatformVersion")29 // Optional: Plugin to configure in the defaults from System Status TomTom IndiGO Application.30 implementation("com.tomtom.ivi.appsuite.gradle.systemstatus:api_appsuitedefaults_systemstatus2:$indigoPlatformVersion")31 // Optional: Plugin to configure in the defaults from Vpa TomTom IndiGO Application.32 implementation("com.tomtom.ivi.appsuite.gradle.vpa:api_appsuitedefaults_vpa:$indigoPlatformVersion")33}
And then, apply necessary plugins in the build.gradle.kts
of the project that builds the APK:
1plugins {2 // Optional: To use the default frontends and services from the TomTom IndiGO platform only.3 // This plugin should be always applied first, before the rest of the `defaults` plugins.4 id("com.tomtom.ivi.platform.defaults.core")56 // Optional: To configure in the defaults from NavKit2 TomTom IndiGO Application.7 id("com.tomtom.ivi.appsuite.navkit2.defaults.navkit2")8 // Optional: To configure in the defaults from Media TomTom IndiGO Application.9 id("com.tomtom.ivi.appsuite.media.defaults.media")10 // Optional: To configure in the defaults from Communications TomTom IndiGO Application.11 id("com.tomtom.ivi.appsuite.communications.defaults.communications")12 // Optional: To configure in the defaults from User Profiles TomTom IndiGO Application.13 id("com.tomtom.ivi.appsuite.userprofiles.defaults.userprofiles")14 // Optional: To configure in the defaults from Vehicle Settings TomTom IndiGO Application.15 id("com.tomtom.ivi.appsuite.vehiclesettings.defaults.vehiclesettings")1617 // Optional: To configure in the defaults from App Store TomTom IndiGO Application.18 id("com.tomtom.ivi.appsuite.appstore.defaults.appstore")19 // Optional: To configure in the defaults from Bluetooth TomTom IndiGO Application.20 id("com.tomtom.ivi.appsuite.bluetooth.defaults.bluetooth")21 // Optional: To configure in the defaults from Companion App TomTom IndiGO Application.22 id("com.tomtom.ivi.appsuite.companionapp.defaults.companionapp")23 // Optional: To configure in the defaults from Hvac TomTom IndiGO Application.24 id("com.tomtom.ivi.appsuite.hvac.defaults.hvac")25 // Optional: To configure in the defaults from Messaging TomTom IndiGO Application.26 id("com.tomtom.ivi.appsuite.messaging.defaults.messaging")27 // Optional: To configure in the defaults from Navigation TomTom IndiGO Application.28 id("com.tomtom.ivi.appsuite.navigation.defaults.navigation")29 // Optional: To configure in the defaults from System Status TomTom IndiGO Application.30 id("com.tomtom.ivi.appsuite.systemstatus.defaults.systemstatus")31 // Optional: To configure in the defaults from Vpa TomTom IndiGO Application.32 id("com.tomtom.ivi.appsuite.vpa.defaults.vpa")33}
Some of these Gradle plugins add menu items. The order in which these plugins are applied defines the order of menu items within the main menu frontend.
Module references
Before adding frontends or IVI service hosts, our recommendation is to implement the
ModuleReference
class.
The ModuleReference
implementation class can be used in the build configurations of the frontend
and IVI service host later on. It will be used to refer to modules that implement the frontend or
IVI service host and to resolve the full-qualified package names as well.
Create the ModuleReference
implementation class (<ProjectName>ModuleReference
) in buildSrc
.
You can use ExampleModuleReference.kt
in
buildSrc/src/main/kotlin/com/tomtom/ivi/buildsrc/dependencies/
as an example.