Join Tencent RTC at NAB Show 2024 in Las Vegas!
Learn more 
Only  $9.9! Get 50,000 minutes with our Starter Plan, perfect for your MVP project.
Only $9.9! Get 50,000 minutes with our Starter Plan, perfect for your MVP project.
Grab It Now 
Join Tencent RTC at NAB Show 2024 in Las Vegas!
Learn more 
Only  $9.9! Get 50,000 minutes with our Starter Plan, perfect for your MVP project.
Only $9.9! Get 50,000 minutes with our Starter Plan, perfect for your MVP project.
Grab It Now 
Conference
Overview
  • Web
    • Integration
    • UI Customization
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomKit
      • TUIRoomEngine
      • TUIRoomEvents
      • TUIRoomEngine Defines
    • FAQs
  • iOS
    • Integration
    • UI Customization
    • Conference Control
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomKit
      • TUIRoomEngine
      • TUIRoomObserver
      • Type Definition
    • FAQs
  • Android
    • Integration
    • UI Customization
    • Conference Control
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomKit
      • TUIRoomEngine
      • TUIRoomObserver
      • Type Definition
    • FAQs
  • Electron
    • Integration
    • UI Customization
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomKit
      • TUIRoomEngine
      • TUIRoomEvent
      • TUIRoomEngine Defines
    • FAQs
  • Windows
    • Integration
    • UI Customization
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomEngine
      • TUIRoomObserver
      • Type Definition
  • Flutter
    • Integration
    • UI Customization
    • Conference Control
    • Cloud Recording
    • API Documentation
      • API Overview
      • TUIRoomEngine
      • TUIRoomObserver
      • Type Definition
    • FAQs
  • Overview
    • Overview
  • Activate the Service
  • Pricing
    • TRTC Conference Monthly Packages
    • Pay-As-You-Go
    • Free Minutes
  • Error Code
Conference

Integration

This article will introduce how to complete the integration of the TUIRoomKit Component in the shortest time. By following this document, you will complete the following key steps within an hour and ultimately obtain an audio/video conference function with a complete UI interface.

Environment preparation

Minimum compatibility with Android 4.4 (SDK API Level 19), recommended to use Android 5.0 (SDK API Level 21) and above.
Android Studio 3.5 and above (Gradle 3.5.4 and above).
Mobile devices with Android 4.4 and above.

Activate the service

Before initiating a meeting with TUIRoomKit, you need to activate the exclusive multi-person audio and video interaction service for TUIRoomKit on the console. For specific steps, please refer to Activate Service.

module source code integration

1. Clone/download the code in Github, and then copy the debug, timcommon, tuichat, and tuiroomkit subdirectories in the Android directory to the app directory in your current project.
2. Find the setting.gradle file in the project root directory and add the following code to it. Its function is to import tuiroomkit as a local module into your current project.
include ':debug'
include ':timcommon'
include ':tuichat'
include ':tuiroomkit'
3. Find the build.gradle file in the app directory and add the following code to it. Its function is to declare the dependence of the current app on the newly added tuiroomkit component.
api project(':tuiroomkit')
4. Add the following line to the gradle.properties file to automatically convert third-party libraries to be compatible with AndroidX:
android.enableJetifier=true
5. To add maven repository and Kotlin support, add the following in the build.gradle file of the root project (same level as settings.gradle):
buildscript {
repositories {
mavenCentral()
maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
}
}
If you are using Gradle 8.x, you need to add the following code.
buildscript {
repositories {
mavenCentral()
maven { url "https://mirrors.tencent.com/nexus/repository/maven-public/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"
}
}
Note:
The version correspondence between Kotlin, Gradle and AGP can be viewed here.
6. Since we use the reflection feature of Java inside the SDK, we need to add some classes in the SDK to the unobfuscated list, so you need to add the following code to the proguard-rules.pro file:
-keep class com.tencent.** { *; }

Quick setup

By referring to the steps below, you can quickly build the main interface of the meeting in your project.

Step 1: Component Login

Add the following code to your project. Its function is to complete the component login by calling the relevant interface in TUILogin. This step is extremely critical, because you can only use the various functions of TUIRoomKit normally after logging in, so please be patient and check whether the relevant parameters are configured correctly:
TUILogin.login(context,
1400000001, // Please replace it with the SDKAppID obtained from activating the service.
"998", // Please replace with your UserID
"xxxxxxxxxx", // You can calculate a UserSig in the console and fill it in this position
callback); // Callback for successful 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.
For more information, please refer to the UserSig related.

Step 2: Set user nickname and avatar

The user's username and avatar can be set by calling setSelfInfo of TUIRoomEngine, which can be set in the callback of successful login.
TUIRoomEngine.setSelfInfo("nickName", "faceUrl", null);

Step 3: The host initiates a quick meeting

1. Add interface layout in activity_conference_owner.xml:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/conference_owner_container" android:layout_width="match_parent" android:layout_height="match_parent" />
2. ConferenceMainFragment is the main interface of the conference. You only need to call quickStartConference to initiate a quick conference, and add ConferenceMainFragment to the current Activity in the quick conference callback onConferenceStarted to initiate a quick conference.
public class ConferenceOwnerActivity extends AppCompatActivity {
private static final String TAG = "ConferenceOwnerActivity";
private ConferenceObserver mConferenceObserver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_conference_owner); ConferenceMainFragment fragment = new ConferenceMainFragment(); setConferenceObserver(fragment);
// Replace "123456" with the corresponding conference number fragment.quickStartConference("123456");
} private void setConferenceObserver(ConferenceMainFragment fragment) { mConferenceObserver = new ConferenceObserver() { @Override public void onConferenceStarted(String conferenceId, ConferenceError error) { super.onConferenceStarted(conferenceId, error); if (error != ConferenceError.SUCCESS) { Log.e(TAG, "Error : " + error); return; } FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(R.id.conference_owner_container, fragment); transaction.commitAllowingStateLoss(); } }; fragment.setConferenceObserver(mConferenceObserver); } }
Note
ConferenceOwnerActivity must inherit FragmentActivity or its subclass, otherwise the interface will not be displayed.

Step 4: General members join the meeting

1. Add interface layout in activity_conference_general.xml:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/conference_general_container" android:layout_width="match_parent" android:layout_height="match_parent" />
2. ConferenceMainFragment is the main interface of the conference. You only need to call joinConference to join the conference and add ConferenceMainFragment to the current Activity in the onConferenceJoined callback to join the conference to participate in the current conference.
public class ConferenceGeneralActivity extends AppCompatActivity {
private static final String TAG = "ConferenceGeneralActivity";
private ConferenceObserver mConferenceObserver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_conference_general); ConferenceMainFragment fragment = new ConferenceMainFragment(); setConferenceObserver(fragment);
// Replace "123456" with the corresponding conference number fragment.joinConference("123456");
} private void setConferenceObserver(ConferenceMainFragment fragment) { mConferenceObserver = new ConferenceObserver() { @Override public void onConferenceJoined(String conferenceId, ConferenceError error) { super.onConferenceJoined(conferenceId, error); if (error != ConferenceError.SUCCESS) { Log.e(TAG, "Error : " + error); return; } FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(R.id.conference_general_container, fragment); transaction.commitAllowingStateLoss(); } }; fragment.setConferenceObserver(mConferenceObserver); } }
Note
ConferenceGeneralActivity must inherit FragmentActivity or its subclass, otherwise the interface will not be displayed.

Step 5: Run

After running the code, you will see the meeting interface as shown below.





Suggestions and Feedback

If you have any suggestions or feedback, please contact info_rtc@tencent.com.