TUIRoomKit
Component in the shortest time. By following this document, you will complete the following key steps within ten minutes and ultimately obtain an audio/video conference function with a complete UI interface.setting.gradle (or settings.gradle.kts)
file in the project root directory and add the following code to it. Its function is to import the tuiroomkit component into your current project.include ':timcommon'include ':tuiroomkit'
include (":timcommon") include (":tuiroomkit")
build.gradle (or build.gradle.kts)
file in the app directory and add the following code to it. Its function is to declare the current app's dependence on the newly added tuiroomkit component.api project(':tuiroomkit')
api(project(":tuiroomkit"))
-keep class com.tencent.** { *; }
// app/src/main/AndroidManifest.xml<application android:name=".DemoApplication" android:allowBackup="false" android:icon="@drawable/app_ic_launcher" android:label="@string/app_name" android:largeHeap="true" android:theme="@style/AppTheme" tools:replace="android:allowBackup">
import com.tencent.qcloud.tuicore.TUILogin; import com.tencent.qcloud.tuicore.interfaces.TUICallback;import com.tencent.cloud.tuikit.roomkit.debug.GenerateTestUserSig;String userId = "denny" // Please replace with your UserIDint sdkAppId = 1400000001 // Please replace with the sdkAppId obtained in step oneString sdkSecretKey = "xxxx" // Please replace with your sdkSecretKeyString userSig = GenerateTestUserSig.genTestUserSig(sdkAppId, userId, sdkSecretKey);TUILogin.login(context,sdkAppId,userId,userSig,new TUICallback() {@Overridepublic void onSuccess() {}@Overridepublic void onError(int errorCode, String errorMessage) {}});
import com.tencent.qcloud.tuicore.TUILogin import com.tencent.qcloud.tuicore.interfaces.TUICallbackimport com.tencent.cloud.tuikit.roomkit.debug.GenerateTestUserSigval userId = "denny" // Please replace with your UserIDval sdkAppId = 1400000001 // Please replace with the sdkAppId obtained in step oneval sdkSecretKey = "xxxx" // Please replace with your sdkSecretKeyval userSig = GenerateTestUserSig.genTestUserSig(sdkAppId, userId, sdkSecretKey)TUILogin.login(this,sdkAppId,userId,userSig,object : TUICallback() {override fun onSuccess() {}override fun onError(errorCode: Int, errorMessage: String) {}})}
TUILogin.login Parameter Description: |
Here is a detailed introduction to several key parameters needed in the login function: SDKAppID:Get it in the last step of activating the service. UserID:The ID of the current user, a string type, only allowed to contain English letters (a-z and A-Z), numbers (0-9), hyphens (-) and underscores (_). UserSig:Use the SDKSecretKey obtained in step 4 of activating the service to encrypt the SDKAppID, UserID and other information to obtain the UserSig, which is an authentication ticket used by Tencent Cloud to identify whether the current user can use TRTC services. You can generate a temporarily available UserSig through the auxiliary tools in the console. Note: Development environment:If you are in the local development and debugging stage, you can use the local GenerateTestUserSig.genTestUserSig() function to generate a userSig. The SDKSecretKey in this method can be easily decompiled and reverse-engineered. Once your key is leaked, attackers can steal your Tencent Cloud traffic. production environment:If your project is to be launched, please use the method of server-side generation of UserSig. |
// Please replace "123456" with your customized conference numberConferenceDefine.StartConferenceParams params = new ConferenceDefine.StartConferenceParams("123456");Intent intent = new Intent(this, ConferenceMainActivity.class);intent.putExtra(KEY_START_CONFERENCE_PARAMS, params);startActivity(intent);
// Please replace "123456" with your customized conference numberval params = ConferenceDefine.StartConferenceParams("123456")val intent = Intent(this, ConferenceMainActivity::class.java)intent.putExtra(KEY_START_CONFERENCE_PARAMS, params);startActivity(intent)
// Please replace "123456" with your customized conference numberConferenceDefine.JoinConferenceParams params = new ConferenceDefine.JoinConferenceParams("123456");Intent intent = new Intent(this, ConferenceMainActivity.class);intent.putExtra(KEY_JOIN_CONFERENCE_PARAMS, params);startActivity(intent);
// Please replace "123456" with your customized conference numberval params = ConferenceDefine.JoinConferenceParams("123456")val intent = Intent(this, ConferenceMainActivity::class.java)intent.putExtra(KEY_JOIN_CONFERENCE_PARAMS, params);startActivity(intent)
Conference main interface | User list |
| |
Was this page helpful?