Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Android

Secure logs

Configure the Thales SDK to generate secure, obfuscated log files.

Enable or disable secure logging

Secure logging is enabled by default. You can disable it during Thales SDK initialization:

Context context;
String serverUrl;
byte[] serverCertificate;
String keyIdentifier;
TMGClientConfiguration configuration = new TMGClientConfiguration(activity, 
                                                                  serverUrl, 
                                                                  serverCertificate, 
                                                                  keyIdentifier);

configuration.enableSecureLog(false);

In this example, enableSecureLog(false) disables log generation after TMGClientConfiguration is instantiated. With the default setting (true), the SDK writes logs for the lifetime of the app process.

You can also pause logging temporarily:

// Disable Secure log temporarily.
TMGClient.getInstance().getSecureLog().setLevel(SecureLogLevel.OFF);

// Resume logging with the default log level.
TMGClient.getInstance().getSecureLog().setLevel(SecureLogLevel.WARN);

Setting the log level to OFF prevents the Thales SDK from writing any new log entries. Set the level back to WARN (default) or another level to resume logging.

Retrieve secure log files

The Thales SDK generates log files in the application sandbox. Retrieve them like this:

secureLogFiles contains a list of File objects for the available log files. Share these files with the Thales delivery team when investigating an issue.

Logcat logs

Ensure that you are using the debug built variant.

Method 1: capture logs with adb

Before you capture logs from an Android device, confirm the following:

  1. The Android Debug Bridge tool (ADB) is ready at the host system.

  2. The USB debugging option is enabled on the device under test.

    • If not enabled, go to Settings > Developer options > USB debugging.

  3. The Android device is connected to the host system using a USB cable, and the USB driver is installed.

You may execute the following command in the command prompt to verify your setup:

A response similar to the following code snippet indicates that the device can be reached by the ADB tool:

  1. Open the command prompt and clear all the log buffers in the device:

  1. Start the log capturing:

Replace LogFileName.txt with your preferred filename.

  1. Perform the use case(s).

  2. Press CTRL+C in the command prompt to stop the log capturing.

  3. Retrieve LogFileName.txt from the directory where you ran step 2.

Method 2: use Android Studio Logcat

View logs directly in the Android Studio Logcat tool window.

  1. Bring up the Logcat tab which can be found on the side or bottom tool bar.

  2. Ensure a device is connected, and run the required use cases for the program.

  3. Filter the messages with TMGSDK tag.

  4. The logs will appear in the Logcat tab.

Last updated

Was this helpful?