Host Prepare Page | Host Streaming Page | Live Stream List | Audience Viewing Page |
![]() | ![]() | ![]() | ![]() |
live and atomic_x subdirectory into the same directory as your current Android project's app folder.
settings.gradle.kts or settings.gradle file and add the JitPack repository address. The third-party library for playing gift SVG animations is hosted on JitPack, so you must include this repository to resolve dependencies.dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()// Add JitPack repository urlmaven { url = uri("https://jitpack.io") }}}
dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()// Add JitPack repository urlmaven { url 'https://jitpack.io' }}}
settings.gradle.kts or settings.gradle file to import the tuilivekit component (as a module).include ':tuilivekit'project(':tuilivekit').projectDir = new File(settingsDir, "live/tuilivekit")include(":atomic")project(':atomic').projectDir = new File(settingsDir, "atomic_x")
include(":tuilivekit")project(":tuilivekit").projectDir = File(settingsDir, "live/tuilivekit")include(":atomic")project(":atomic").projectDir = File(settingsDir, "atomic_x")
build.gradle.kts or build.gradle file. Add the following dependency to declare that your app module relies on the newly added tuilivekit component module.dependencies {// Add tuilivekit dependencyapi(project(":tuilivekit"))}
dependencies {// Add tuilivekit dependencyapi project(':tuilivekit')}
-keep class com.tencent.** { *; }-keep class com.tencent.beacon.** { *; }-keep class com.tencent.cloud.iai.lib.** { *; }-keep class com.tencent.qimei.** { *; }-keep class com.tencent.xmagic.** { *; }-keep class com.trtc.uikit.livekit.component.gift.store.model.** { *; }-keep class com.trtc.uikit.livekit.livestreamcore.** { *; }-keep class com.tcmediax.** { *; }# Obfuscation rules for Google's serialization/deserialization framework Gson library-keep class com.google.gson.** { *; }# Obfuscation rules for beauty effect-keep class androidx.exifinterface.** { *; }-keep class com.gyailib.** { *; }-keep class org.extra.** { *; }-keep class org.libpag.** { *; }-keep class org.light.** { *; }# Obfuscation rules for playing giftsSVGanimation-keep class com.opensource.svgaplayer.proto.** { *; }-keep class com.squareup.wire.** { *; }
tools:replace="android:allowBackup" and android:allowBackup="false" to the <application> node in your app/src/main/AndroidManifest.xml file. This overrides the settings within the component and disables the backup feature.<application...// Add the following configuration to override the settings in the dependent SDKandroid:allowBackup="false"tools:replace="android:allowBackup">

// 1. Import dependencyimport com.tencent.qcloud.tuicore.TUILogin// 2. Call the login API. It is recommended to call TUILogin after your own login business is completed.TUILogin.login(applicationContext,1400000001, // Please replace with the SDKAppID from the service activation console"denny", // Please replace with your UserID"xxxxxxxxxxx", // You can generate a UserSig in the console and fill it in hereobject : TUICallback() {override fun onSuccess() {Log.i(TAG, "login success")}override fun onError(errorCode: Int, errorMessage: String) {Log.e(TAG, "login failed, errorCode: $errorCode msg:$errorMessage")}})
// 1. Import dependencyimport com.tencent.qcloud.tuicore.TUILogin// 2. Call the login API. It is recommended to call TUILogin after completing your own login service.TUILogin.login(context,1400000001, // Please replace with the SDKAppID from the service activation console"denny", // Please replace with your UserID"xxxxxxxxxxx", // You can generate a UserSig in the console and fill it in herenew TUICallback() {@Overridepublic void onSuccess() {Log.i(TAG, "login success");}@Overridepublic void onError(int errorCode, String errorMessage) {Log.e(TAG, "login failed, errorCode: " + errorCode + " msg:" + errorMessage);}});
Parameter | Type | Description |
SDKAppID | Int | |
UserID | String | The unique ID for the current user. Must contain only English letters, numbers, hyphens, and underscores. |
userSig | String | A ticket for Tencent Cloud authentication. Please note: Development Environment: You can use the local GenerateTestUserSig.genTestSig function to generate a UserSig or generate a temporary UserSig via the UserSig Generation Tool.Production Environment: To prevent key leakage, you must use a server-side method to generate UserSig. For details, see Generating UserSig on the Server. |
onKickedOffline callback. At this point, you can display a UI prompt to the user and call TUILogin.login to login again.onUserSigExpired callback while online, it means the userSig previously issued for that user has expired. If the user's login session on your backend is still valid, you can have your app request a new userSig from your backend and call TUILogin.login to renew the login session.class YourLoginService : TUILoginListener() {// Listen to login status callbackfun addObserver() {TUILogin.addLoginListener(this)}// Cancel listening for login status callbackfun removeObserver() {TUILogin.removeLoginListener(this)}// User kicked offline callbackoverride fun onKickedOffline() {// Your business code: UI prompts the user, then log in again}// User signature expired callbackoverride fun onUserSigExpired() {// Your business code: If the current user is still logged in on your backend, you can let your app request a new userSig from the backend and call TUILogin.login to renew the login status.}}
class YourLoginService extends TUILoginListener {// Listen to login status callbackpublic void addObserver() {TUILogin.addLoginListener(this);}// Cancel listening for login status callbackpublic void removeObserver() {TUILogin.removeLoginListener(this);}// User kicked offline callback@Overridepublic void onKickedOffline() {// Your business code: UI prompts the user, then log in again}// User signature expired callback@Overridepublic void onUserSigExpired() {// Your business code: If the current user is still logged in on your backend, you can let your app request a new userSig from the backend and call TUILogin.login to renew the login status.}}
Feature | Description | Integration Guide |
Host Streaming | The complete workflow for a host to start a stream, including pre-stream setup and various in-stream interactions. | |
Audience Viewing | Audience can watch live streaming after entering the anchor's live streaming room, with features like audience mic connection, live room information, online audience, and bullet screen display. | |
Live Stream List | Display the live stream list interface and features, including the live stream list and room information display. |
TUILogin.login once. We recommend associating TUILogin.login and TUILogin.logout with your app's own user login and logout business logic.allowBackup compilation error shown in the figure below after code integration?
allowBackup attribute is configured in the AndroidManifest.xml of multiple modules, which causes a conflict during the manifest merge process.AndroidManifest.xml file, you can either delete the allowBackup attribute or change it to false to disable backup and restore functionality. Crucially, add tools:replace="android:allowBackup" to the <application> node to override the settings of other modules with your own configuration. See the example fix:

Feedback