- Documentation
Torch Log Service
SDK reference
Android SDK
Getting started
Android SDK
Getting started
Getting started
This topic describes how to use Torch Log Service (TLS) SDK for Android to quickly collect logs.
Before you begin
warning
We recommend that you use environment variables to dynamically get identity authentication information such as Volcano Engine AccessKey. Otherwise, hard-coded AccessKey information leads to data security risks.
Precautions
Uploading logs to TLS is based on the http protocol. For Android 11.0, if HttpUrlConnection is used in an HTTP request, the following exception occurs:
W/System.err: java.io.IOException: Cleartext HTTP traffic to **** not permitted
For Android 11.0 and later, perform the following operations:
- In the res folder of your project, create a folder named xml. Then, create a file named network_security_config.xml in the xml folder.
- The file content is as follows. Replace tls-ap-southeast-1.ibytepluses.com with the actual endpoint.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!--<base-config cleartextTrafficPermitted="true" />-->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">tls-ap-southeast-1.ibytepluses.com</domain>
</network-security-config>
- Modify the AndroidManifest.xml file, and add the following attribute to the application tag:
android:networkSecurityConfig="@xml/network_security_config"
Sample project
TLS offers a sample project of collecting logs on GitHub: android-demo. You can use this sample project to run the log collection process to test the collection capability of TLS SDK for Android. - Create an Android application through the sample project.
- Download the source code of the sample project from GitHub.
- Create a project through Android Studio and import source code files.
- In the attributes section of the PutLogExample.java file, specify information such as Volcano Engine AccessKey and the topic ID.
- Test the collection capability of TLS SDK for Android.
- Connect your Android device to a computer.
- On Android Studio, click Run 'app'.
- If the application runs properly, the sample project is installed to the Android device.
- Start the application and send logs as prompted.
- TLS SDK for Android collects the log data of the application and sends the data to the specified topic. You can preview the log data in the TLS console.
Last updated: 2025.10.11 16:44:07