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 = new File(settingsDir, "live/tuilivekit")include(":atomic")project(':atomic').projectDir = new 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 io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.login.LoginStoreprivate const val TAG = "LoginStore"// 2.Call the login API. It is recommended to call TUILogin after your own login business is completed.LoginStore.shared.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 : CompletionHandler {override fun onSuccess() {Log.i(TAG, "LoginStore login success")}override fun onFailure(code: Int, desc: String) {Log.e(TAG, "LoginStore login failed, $code errorMessage:$desc")}})
// 1.Import dependencyimport io.trtc.tuikit.atomicxcore.api.CompletionHandler;import io.trtc.tuikit.atomicxcore.api.login.LoginStore;// 2.Call the login API. It is recommended to call TUILogin after completing your own login service.private static final String TAG = "LoginStore";LoginStore.shared.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 CompletionHandler() {@Overridepublic void onSuccess() {Log.i(TAG, "LoginStore login success");}@Overridepublic void onFailure(int code, String desc) {Log.e(TAG, "LoginStore login failed, " + code + " errorMessage:" + desc);}});
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.import io.trtc.tuikit.atomicxcore.api.login.LoginListenerimport io.trtc.tuikit.atomicxcore.api.login.LoginStoreclass YourLoginService {// Instantiate listenerprivate val loginListener = object : LoginListener() {// Callback for user being kicked offlineoverride fun onKickedOffline() {// Handle: Prompt user in UI, then re-login}// Callback for user signature expiredoverride fun onLoginExpired() {// Handle: If the user's backend session is valid, request a new userSig and call LoginStore.shared.login to renew the session}}// Subscribe to login state callbacksfun subscribeLoginStatus() {LoginStore.shared.addLoginListener(loginListener)}// Unsubscribe from login state callbacksfun unsubscribeLoginStatus() {LoginStore.shared.removeLoginListener(loginListener)}}
import io.trtc.tuikit.atomicxcore.api.login.LoginListener;import io.trtc.tuikit.atomicxcore.api.login.LoginStore;public class YourLoginService {// Instantiate listenerprivate final LoginListener loginListener = new LoginListener() {// Callback for user being kicked offline@Overridepublic void onKickedOffline() {// Handle: Prompt user in UI, then re-login}// Callback for user signature expired@Overridepublic void onLoginExpired() {// Handle: If the user's backend session is valid, request a new userSig and call LoginStore.shared.login to renew the session}};// Subscribe to login state callbackspublic void subscribeLoginStatus() {LoginStore.shared.addLoginListener(loginListener);}// Unsubscribe from login state callbackspublic void unsubscribeLoginStatus() {LoginStore.shared.removeLoginListener(loginListener);}}
Feature | Description | Integration Guide |
Video Live Streaming | Includes a full suite of features such as host broadcasting, audience viewing, interactive co-hosting, beauty filters, gifts, and bullet chat. | |
Voice Chat Room | Includes complete business logic such as mic seat management, background music (BGM), gift interactivity, and voice room control. | |
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:

フィードバック