settings.gradle.kts (or settings.gradle)
file: Add the jitpack repository dependency (to download the SVG animation library for playing gifts, SVGAPlayer):dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral()// Add the jitpack repository URL maven { url = uri("https://jitpack.io") } } }
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral()// Add the jitpack repository URL maven { url 'https://jitpack.io' } } }
settings.gradle.kts (or settings.gradle)
file. It will import the tuilivekit component downloaded in Step 2 into your current project:include(":tuilivekit")
include ':tuilivekit'
build.gradle.kts (or build.gradle)
file and add the following code. It declares the dependency of the current app on the newly added tuilivekit component:api(project(":tuilivekit"))
api project(':tuilivekit')
TRTC SDK
, IM SDK
, tuiroomengine
, and the common library tuicore
. Developers do not need to configure them separately. To upgrade the version, modify the tuilivekit/build.gradle
file.proguard-rules.pro
file:-keep class com.tencent.** { *; }
AndroidManifest.xml
file, and add tools:replace="android:allowBackup" and android:allowBackup="false" to the application node to override the component's settings with your own.// app/src/main/AndroidManifest.xml<application ...// Add the following configuration to override the settings in the dependent SDKandroid:allowBackup="false" tools:replace="android:allowBackup">
// Log in TUILogin.login(applicationContext, 1400000001, // Please replace with the SDKAppID obtained in step one "denny", // Please replace with your UserID "xxxxxxxxxxx", // You can calculate a UserSig in the console and fill it in here object : 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") } })
// Log inTUILogin.login(context,1400000001, // Please replace with the SDKAppID obtained in Step 1"denny", // Please replace with your UserID"xxxxxxxxxxx", // You can calculate 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 | In the final step of step one, you have already obtained it, so it will not be repeated here. |
UserID | String | The ID of the current user, string type, is only allowed to contain letters (a-z and A-Z), numbers (0-9), hyphens, and underscores. |
userSig | String | Use the SecretKey obtained in Step One, Step 3 to encrypt information such as SDKAppID and UserID to obtain UserSig, which is a token for authentication used by Tencent Cloud to identify whether the current user can use TRTC services. You can generate a temporarily usable UserSig through the Auxiliary Tools in the console. For more information, see UserSig. |
GenerateTestUserSig.genTestSig
function to generate UserSig. In this method, the SDKSecretKey is vulnerable to decompilation and reverse engineering. If your key is leaked, attackers can steal your Tencent Cloud traffic.import com.trtc.uikit.livekit.VideoLiveKitVideoLiveKit.createInstance(applicationContext).startLive("roomId")
import com.trtc.uikit.livekit.VideoLiveKit;VideoLiveKit.createInstance(getApplicationContext()).startLive("roomId");
Video Live Preview Screen | Live video streaming with pictures |
import com.trtc.uikit.livekit.VideoLiveKitVideoLiveKit.createInstance(applicationContext).joinLive("roomId")
import com.trtc.uikit.livekit.VideoLiveKit;VideoLiveKit.createInstance(getApplicationContext()).joinLive("roomId");
Video Live Room | Video Live Room |
Was this page helpful?