tencent cloud

Tencent Real-Time Communication

Release Notes and Announcements
Release Notes
Recent Product Announcement
TRTC Live (TUILiveKit) Product Launch Announcement
TRTC Conference Official Editions Launched
The commercial version of Conference is coming soon
Terms and Conditions Applicable to $9.9 Starter Package
Rules for the "First Subscription $100 Discount" Promotion
Announcement on the Start of Beta Testing for Multi-person Audio and Video Conference
TRTC Call Official Editions Launched
License Required for Video Playback in New Version of LiteAV SDK
TRTC to Offer Monthly Packages
Product Introduction
Overview
Concepts
Features
Strengths
Use Cases
Performance Statistics
Tencent RTC Quickplay: Experience Ultimate Real-Time Audio and Video Interaction!
Purchase Guide
Billing Overview
Free Minutes
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
FAQs
Refund Instructions
User Tutorial
Free Demo
Call
Overview
Activate the Service
Run Demo
Integration
Offline Call Push
Conversational Chat
On-Cloud Recording
AI Noise Reduction
UI Customization
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
Release Notes
FAQs
Conference
Overview(TUIRoomKit)
Activate the Service (TUIRoomKit)
Run Demo(TUIRoomKit)
Integration(TUIRoomKit)
Screen Sharing (TUIRoomKit)
Schedule a meeting (TUIRoomKit)
In-meeting Call (TUIRoomKit)
UI Customization(TUIRoomKit)
Virtual Background (TUIRoomKit)
Conference Control (TUIRoomKit)
Cloud Recording (TUIRoomKit)
AI Noise Reduction (TUIRoomKit)
In-Conference Chat (TUIRoomKit)
Robot Streaming (TUIRoomKit)
Enhanced Features (TUIRoomKit)
Client APIs (TUIRoomKit)
Server APIs (TUIRoomKit)
FAQs (TUIRoomKit)
Error Code (TUIRoomKit)
SDK Update Log (TUIRoomKit)
Live
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Run Demo
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDK Download
API Examples
Usage Guidelines
API Reference Manual
Advanced Features
AI Integration
Overview
Configure MCP Server
Install Skills
Integration Guide
FAQ
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
Console Guide
Application Management
Package Management
Usage Statistics
Monitoring Dashboard
Development Assistance
Solution
Real-Time Chorus
FAQs
Migration Guide
Billing
Features
UserSig
Firewall Restrictions
How to Downsize Installation Package
Android and iOS
Web
Flutter
Electron
TRTCCalling for Web
Audio and Video Quality
Others
Legacy Documentation
RTC RoomEngine SDK(Old)
Integrating TUIRoom (Web)
Integrating TUIRoom (Android)
Integrating TUIRoom (iOS)
Integrating TUIRoom (Flutter)
Integrating TUIRoom (Electron)
TUIRoom APIs
On-Cloud Recording and Playback (Old)
RTC Analytics Monthly Packages (Previous Version)
Protocols and Policies
Compliance
Security White Paper
Notes on Information Security
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC Policy
Privacy Policy
Data Processing And Security Agreement
Glossary

Android

PDF
Focus Mode
Font Size
Last updated: 2024-05-21 15:05:29
This document describes how to import the SDK into your project.



Environment Requirements

Android Studio 3.5 or later.
Android 4.1 (SDK API level 16) or later

Step 1. Import the SDK

Method 1. Automatic loading (aar)

The TRTC SDK has been released to the mavenCentral repository, and you can configure Gradle to download updates automatically.
1. Add the TRTC SDK dependency to dependencies.
dependencies {
implementation 'com.tencent.liteav:LiteAVSDK_TRTC:latest.release'
}
2. In defaultConfig, specify the CPU architecture to be used by your application.
defaultConfig {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
Note:
Currently, the TRTC SDK supports armeabi-v7a, and arm64-v8a.
3. Click

Sync Now to automatically download the SDK and integrate them into your project.

Method 2. Download the SDK and import it manually

1. Download the SDK and decompress it locally.
2. Copy the decompressed AAR file to the app/libs directory of your project.
3. Add flatDir to build.gradle under your project's root directory to specify the local path for the repository.



4. Add code in app/build.gradle to import the AAR file.



5. In defaultConfig of app/build.gradle, specify the CPU architecture to be used by your application.
defaultConfig {
ndk {
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
}
}
Note:
Currently, the TRTC SDK supports armeabi, armeabi-v7a, and arm64-v8a.
6. Click

Sync Now to integrate the TRTC SDK.

Step 2. Configure app permissions

Configure application permissions in AndroidManifest.xml. The TRTC SDK requires the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
Note:
Do not set android:hardwareAccelerated="false". Disabling hardware acceleration will result in failure to render remote users' videos.

Step 3. Set obfuscation rules

In the proguard-rules.pro file, add the classes related to the TRTC SDK to the "do not obfuscate" list:
-keep class com.tencent.** { *;}

Using SDK Through C++ APIs (Optional)

If you prefer to use C++ APIs instead of Java for development, you can perform this step. If you only use Java to call the TRTC SDK, skip this step.
1. First, you need to integrate the TRTC SDK by importing JAR and SO libraries as instructed above.
2. Copy the C++ header file in the SDK to the project (path: SDK/LiteAVSDK_TRTC_xxx/libs/include) and configure the include folder path and dynamic link to the SO library in CMakeLists.txt.
cmake_minimum_required(VERSION 3.6)

# Configure the C++ API header file path
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include # Copied from `SDK/LiteAVSDK_TRTC_xxx/libs/include`
)

add_library(
native-lib
SHARED
native-lib.cpp)

# Configure the path of the `libliteavsdk.so` dynamic library
add_library(libliteavsdk SHARED IMPORTED)
set_target_properties(libliteavsdk PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libliteavsdk.so)

find_library(
log-lib
log)

# Configure the dynamic link as `libliteavsdk.so`
target_link_libraries(
native-lib
libliteavsdk
${log-lib})
3. Use the namespace: The methods and types of cross-platform C++ APIs are all defined in the trtc namespace. To simplify your code, we recommend you use the trtc namespace.
using namespace trtc;
Note:
For more information on how to configure the Android Studio C/C++ development environments, see Add C and C++ code to your project.
Currently, only the TRTC edition of the SDK supports C++ APIs. For more information on how to use C++ APIs, see Overview.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback