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
      • RoomKit API
      • RoomEngine API
        • API Overview
        • TUIRoomEngine
        • TUIRoomEvents
        • TUIRoomEngine Defines
    • FAQs
  • iOS
    • Integration
    • UI Customization
    • Conference Control
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • RoomKit API
      • RoomEngine API
        • API Overview
        • TUIRoomEngine
        • TUIRoomObserver
        • Type Definition
    • FAQs
  • Android
    • Integration
    • UI Customization
    • Conference Control
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • RoomKit API
      • RoomEngine API
        • API Overview
        • TUIRoomEngine
        • TUIRoomObserver
        • Type Definition
    • FAQs
  • Electron
    • Integration
    • UI Customization
    • In-Conference Chat
    • Cloud Recording
    • API Documentation
      • RoomKit API
      • RoomEngine API
        • API Overview
        • TUIRoomEvent
        • TUIRoomEngine
        • TUIRoomEngine Defines
    • FAQs
  • Flutter
    • Integration
    • UI Customization
    • Conference Control
    • Cloud Recording
    • API Documentation
      • RoomKit API
      • RoomEngine API
        • 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.

Step 1: 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.

Step 2: Download the TUIRoomKit component

1. Clone/download the code in Github, and then copy the timcommon and tuiroomkit subdirectories in the Android directory to the app directory in your current project.

Step 3: Project configuration

1. Find the 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.
Java
Kotlin
include ':timcommon'
include ':tuiroomkit'
include (":timcommon") include (":tuiroomkit")
2. Find the 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.
Java
Kotlin
api project(':tuiroomkit')
api(project(":tuiroomkit"))
3. 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.** { *; }

Step 4: 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:
Java
Kotlin
TUILogin.login(context,
1400000001, // Please replace it 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 this position
new TUICallback() {
@Override
public void onSuccess() {
Log.i(TAG, "login success");
}
@Override
public void onError(int errorCode, String errorMessage) {
Log.e(TAG, "login failed, errorCode: " + errorCode + " msg:" + errorMessage);
}
});
TUILogin.login(this,
1400000001, // Please replace it 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 this position
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);
}
})
}
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 5: Start your first meeting

1. Create a new activity_conference.xml file and add the interface layout:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/conference_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.
Java
Kotlin
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);

ConferenceMainFragment fragment = new ConferenceMainFragment();
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_container, fragment);
transaction.commitAllowingStateLoss();
}
};
fragment.setConferenceObserver(mConferenceObserver);
// Replace "123456" with the corresponding conference number
fragment.quickStartConference("123456");
}
}
class ConferenceOwnerActivity : AppCompatActivity() { private val tag: String = "ConferenceOwnerActivity" private var mConferenceObserver : ConferenceObserver? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_conference) var fragment = ConferenceMainFragment() mConferenceObserver = object: ConferenceObserver() { override fun onConferenceStarted(conferenceId: String?, error: ConferenceError?) { super.onConferenceStarted(conferenceId, error) if (error != ConferenceError.SUCCESS) { Log.e(tag, "Error : $error") return } val fragmentManager = supportFragmentManager val transaction = fragmentManager.beginTransaction() transaction.add(R.id.conference_container, fragment) transaction.commitAllowingStateLoss() } } fragment.setConferenceObserver(mConferenceObserver) // Replace "123456" with the corresponding conference number fragment.quickStartConference("123456") } }
Note
ConferenceOwnerActivity must inherit AppCompatActivity, otherwise the interface will not be displayed.

Step 6: General members join the meeting

1. 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.
Java
Kotlin
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);

ConferenceMainFragment fragment = new ConferenceMainFragment();
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_container, fragment);
transaction.commitAllowingStateLoss();
}
};
fragment.setConferenceObserver(mConferenceObserver);
// Replace "123456" with the corresponding conference number
fragment.joinConference("123456");
}
}
class ConferenceGeneralActivity : AppCompatActivity() { private val tag: String = "ConferenceGeneralActivity" private var mConferenceObserver : ConferenceObserver? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_conference) var fragment = ConferenceMainFragment() mConferenceObserver = object: ConferenceObserver() { override fun onConferenceJoined(conferenceId: String?, error: ConferenceError?) { super.onConferenceJoined(conferenceId, error) if (error != ConferenceError.SUCCESS) { Log.e(tag, "Error : $error") return } val fragmentManager = supportFragmentManager val transaction = fragmentManager.beginTransaction() transaction.add(R.id.conference_container, fragment) transaction.commitAllowingStateLoss() } } fragment.setConferenceObserver(mConferenceObserver) // Replace "123456" with the corresponding conference number fragment.joinConference("123456789") } }
Note
ConferenceGeneralActivity must inherit AppCompatActivity, otherwise the interface will not be displayed.



Conference main interface



User list

Common problem

If you encounter problems with access and use, please see the FAQ.

Suggestions and Feedback

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