Sorry, you need to enable JavaScript to visit this website.

Getting started

Getting started

IMPORTANT: The TomTom Geofencing API and Geofencing module in the Maps SDK for Android are currently
in Public Preview. To find out what our Public Preview is and to revisit our Terms and Conditions,
see the Public Preview Page. Under Public Preview, specific terms and conditions apply
which are described here in section 4 of the Terms and Conditions

Modify build.gradle (app/build.gradle)

Apply the following lines to your module’s dependency section in the build.gradle file, for example: app/build.gradle:

implementation("com.tomtom.online:sdk-geofencing:2.4292")

 

If you use more than one SDK library, make sure that all libraries have the same version.

Modify AndroidManifest.xml

Edit the AndroidManifest.xml file and add the service key inside the <application> tag. This is taken
from the Geofencing API site.

<meta-data
            android:name="GeofencingApi.Key"
            android:value="your-tomtom-key" />

Enable Java 8 Support in the build.gradle file

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Logging

TomTom SDK Log level

In TomTom we are constantly working on the quality of our products. That is why it is very important to have logs
as detailed as possible for our support team to provide accurate help or bugfixes. The Maps SDK for Android has an advanced
mechanism to gather and send logs to our support team. To enable logging and specify a log level please add below code to your app:

Example:

@Override
public void onCreate() {
    super.onCreate();
    LogUtils.enableLogs(Log.VERBOSE);
  • android.util.Log.VERBOSE will print all logs from TomTom SDK.

  • android.util.Log.DEBUG will print debug logs from TomTom SDK.

Note: Logs from the SDK libraries are disabled by default.

Collecting logs

TomTom log

Logs from an application can be collected into a file on the SD card.

LogUtils.LogFileCollector.collectLogsToFile(logsFilePath);

A special permission should be added into your AndroidManifest.xml file to save logs on the SD card. For example:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

When the sdk-maps module is used the problem with supporting runtime permissions is handled by the SDK with the following method:

_

@Override
public void onMapReady(@NonNull TomtomMap tomtomMap) {
    tomtomMap.collectLogsToFile(SampleApp.LOGCAT_PATH);
}
override fun onMapReady(tomtomMap: TomtomMap) {
    tomtomMap.collectLogsToFile(SampleApp.LOGCAT_PATH)
}

Important: Since Android API level 23, it is required to ask the user for runtime permission to write into the SD card.

Register crash observer

Using the crash observer makes it possible to automate the process of preparing an email message with attached
logs which were already collected and stored on the SD card. To do so, please register a crash handler with below code.
Crash observer doesn’t break your already used handlers (like Crashlitics).

LogUtils.registerCrashObserver(getApplicationContext(), Uri.parse("file://" + LOGCAT_PATH));

Bug report

To enable an advanced logging mechanism which collects detailed data from logcat like: threads, services
and phone states, please use the following code:

adb bugreport issue01

This produces an issue01.zip file.

You are here