User Consent

Last edit: 2023.07.27

For some online services to work, the user must agree to share their personal data. For example, to be able to see traffic on the map, the user has to agree to share their location, by giving consent.

In TomTom Digital Cockpit (TTDC) there are a number of consent types. This allows for giving the end-user granular control over which data is shared. The consent types are:

  • ANALYTICS - For data analytics events to be logged and collected by TomTom's back-end.
  • CONNECTED_SERVICES - For online navigation services and features, such as for search and routing. Note: onboard services still work without consent, as no personal data is shared.
  • LOCATION - For sharing the current location. For example, this consent is required to get traffic services.

To set the end user's consent in the TTDC platform, the following interface need to be implemented: PrivacySettingsService.

For more details on how to create an IVI service, see the Create an IVI Service page.

For legal reasons, the User Consent UI cannot be implemented in the TTDC platform itself, but must instead be implemented by the customer for their end users.

The following example is using the template app, from the examples source, to add user consent.

ConfigureConsentPrivacySettingsService.kt:

Implement the PrivacySettingsService interface.

1package com.example.ivi.template.app.privacysettings
2
3import com.tomtom.ivi.platform.framework.api.common.annotations.IviExperimental
4import com.tomtom.ivi.platform.framework.api.ipc.iviservice.IviServiceHostContext
5import com.tomtom.ivi.platform.navigation.api.service.privacysettings.PrivacySettingsService
6import com.tomtom.ivi.platform.navigation.api.service.privacysettings.PrivacySettingsServiceBase
7
8/**
9 * Implementation for the [PrivacySettingsService]. This service is implemented to
10 * provide consent for data collection.
11 */
12@OptIn(IviExperimental::class)
13internal class ConfigureConsentPrivacySettingsService(iviServiceHostContext: IviServiceHostContext):
14 PrivacySettingsServiceBase(iviServiceHostContext) {
15
16 override fun onCreate() {
17 super.onCreate()
18 /*
19 * Ask the end-user if they agree to share their personal data here. Then set the
20 * relevant consentTypes.
21 *
22 * NOTE: This example enables consent for everything, without asking the user!
23 */
24 consentTypes = setOf(
25 PrivacySettingsService.ConsentType.ANALYTICS,
26 PrivacySettingsService.ConsentType.CONNECTED_SERVICES,
27 PrivacySettingsService.ConsentType.LOCATION
28 )
29 serviceReady = true
30 }
31
32 companion object
33}

ConfigureConsentPrivacySettingsServiceHostBuilder.kt:

Implement a host builder for the service.

1package com.example.ivi.template.app.privacysettings
2
3import com.tomtom.ivi.platform.framework.api.ipc.iviservice.AnyIviServiceBase
4import com.tomtom.ivi.platform.framework.api.ipc.iviservice.IviServiceHostContext
5import com.tomtom.ivi.platform.framework.api.ipc.iviservice.SimpleIviServiceHostBuilder
6
7public class ConfigureConsentPrivacySettingsServiceHostBuilder : SimpleIviServiceHostBuilder() {
8
9 public override fun createIviServices(iviServiceHostContext: IviServiceHostContext):
10 Collection<AnyIviServiceBase> =
11 listOf(ConfigureConsentPrivacySettingsService(iviServiceHostContext))
12
13 public companion object
14}

build.gradle.kts:

Finally, replace the stock service with your own implementation.

1import com.tomtom.ivi.platform.gradle.api.common.annotations.EXPERIMENTAL_API_USAGE
2import com.tomtom.ivi.platform.gradle.api.common.dependencies.IviPlatformModuleReference
3import com.tomtom.ivi.platform.gradle.api.common.dependencies.ModuleReference
4import com.tomtom.ivi.platform.gradle.api.common.iviapplication.config.IviServiceHostConfig
5import com.tomtom.ivi.platform.gradle.api.common.iviapplication.config.IviServiceInterfaceConfig
6import com.tomtom.ivi.platform.gradle.api.defaults.config.privacySettingsServiceHost
7
8public val configurePrivacySettingsServiceHost: IviServiceHostConfig =
9 IviServiceHostConfig(
10 serviceHostBuilderName = "ConfigureConsentPrivacySettingsServiceHostBuilder",
11 ModuleReference(
12 groupName = "com.example.ivi",
13 moduleName = "template_app",
14 packageName = "com.example.ivi.template.app.privacysettings"
15 ),
16 interfaces = listOf(
17 IviServiceInterfaceConfig(
18 serviceName = "PrivacySettingsService",
19 serviceApiModule = IviPlatformModuleReference(
20 "platform_navigation_api_service_privacysettings"
21 )
22 )
23 )
24 )
25
26// Remove the Stock version and add your own service host instead.
27import com.tomtom.ivi.platform.gradle.api.defaults.config.privacySettingsServiceHost
28
29ivi {
30 // ...
31 application {
32 // ...
33 services {
34 @Suppress(EXPERIMENTAL_API_USAGE)
35 removeHost(privacySettingsServiceHost)
36 addHost(configurePrivacySettingsServiceHost)
37 }
38
39 // ...