Room Preparation Page | Room Main Page | Member Management |
![]() | ![]() | ![]() |
room and atomic_x subdirectories to the same directory level as your Android project's app folder.
settings.gradle.kts or settings.gradle file to include the tuiroomkit component.include(":tuiroomkit")project(":tuiroomkit").projectDir = File(settingsDir, "room/tuiroomkit")include(":atomic_x")project(":atomic_x").projectDir = File(settingsDir, "atomic_x")
build.gradle.kts (or build.gradle) file inside the app directory, and declare the dependency for the newly added tuiroomkit component.dependencies {// Add tuiroomkit dependencyapi(project(":tuiroomkit"))}
proguard-rules.pro file to prevent obfuscation of essential classes and ensure normal operation.-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.tcmediax.** { *; }# Google serialization/deserialization framework Gson library related rules-keep class com.google.gson.** { *; }
tools:replace="android:allowBackup" and android:allowBackup="false" to the ` node in your app/src/main/AndroidManifest.xml`, overriding settings from the component.<manifest xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"><!-- Add the following configuration to override settings from dependent SDKs --><applicationandroid:allowBackup="false"tools:replace="android:allowBackup" /></manifest>

import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport io.trtc.tuikit.atomicxcore.api.login.LoginStoreimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport android.util.Logclass MainActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)LoginStore.shared.login(this, // context1400000001, // Replace with your project's sdkAppID"test_001", // Replace with your project's userID"xxxxxxxxxxx", // Replace with your project's userSigobject : CompletionHandler {override fun onSuccess() {// Handle login successLog.d("Login", "login success");}override fun onFailure(code: Int, desc: String) {// Handle login failureLog.e("Login", "login failed, code: $code, error: $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. |
setSelfInfo API in LoginStore:import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.login.LoginStoreimport io.trtc.tuikit.atomicxcore.api.login.UserProfileprivate val TAG = "Test"fun setSelfInfo() {val userProfile = UserProfile(userID = "test_001", // The userID you have logged in withnickname = "tom", // Set nicknameavatarURL = "http://xxx.png" // Set avatar URL)LoginStore.shared.setSelfInfo(userProfile, object : CompletionHandler {override fun onSuccess() {Log.d(TAG, "setSelfInfo success")}override fun onFailure(code: Int, desc: String) {Log.e(TAG, "setSelfInfo failed code:$code, message:$desc")}})}
Parameter | Type | Required | Description |
userProfile | UserProfile | Yes | User profile model, includes: userID: User ID to set nickname: Nickname avatarURL: Avatar URL |
completion | CompletionHandler | No | Callback for the result of setting user profile. If failed, returns error code and message. |
RoomMainView serves as the core interface, offering complete multi-party audio/video conference functionality. The following example shows how to integrate RoomMainView as a room owner.RoomMainView lazily.onCreate, add RoomMainView and set it to fill the layout.import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.roomkit.view.RoomMainViewimport io.trtc.tuikit.atomicxcore.api.room.CreateRoomOptions// MainActivity represents the Activity where you load the room main pageclass MainActivity : AppCompatActivity() {// 1 Load the room creation viewprivate val roomView: RoomMainView by lazy {RoomMainView(this).apply {// 2 Build room entry configurationval config = RoomMainView.ConnectConfig(autoEnableMicrophone = true, // Automatically enable microphone upon enteringautoEnableCamera = true, // Automatically enable camera upon enteringautoEnableSpeaker = true // Automatically enable speaker upon entering)val options = CreateRoomOptions(roomName = "roomName") // Room nameval behavior = RoomMainView.RoomBehavior.Create(options)// 3 Initialize the room main pageinit("roomID", behavior, config)}}override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// 4. Add the view to the ActivitysetContentView(roomView)}}
Parameter | Type | Description |
roomID | String | Unique room identifier. Length: 0–48 bytes. Use only numbers, English letters (case-sensitive), underscores (_), and hyphens (-). Avoid spaces and Chinese characters. |
roomType | RoomType | Room type: STANDARD: Standard room.WEBINAR: Webinar room.Use STANDARD for regular conference rooms. |
behavior | RoomBehavior | Initialization behavior: Create: Room owner creates the room (requires room creation configuration; see CreateRoomOptions Structure Details). Join: Participant joins the room. |
config | ConnectConfig | Configuration for audio/video device controls upon room entry. |
Parameter | Type | Description |
autoEnableMicrophone | Boolean | Auto-enable microphone on entry: true: Automatically enabled (default). false: Not auto-enabled. |
autoEnableCamera | Boolean | Auto-enable camera on entry: true: Automatically enabled (default). false: Not auto-enabled. |
autoEnableSpeaker | Boolean | Auto-enable speaker on entry: true: Automatically enabled (default). false: Not auto-enabled. |
Parameter Name | Type | Required | Description |
roomName | String | No | Room name (optional, defaults to empty string). Length: 0–60 bytes. Supports Chinese/English, numbers, special characters. |
password | String | No | Room password ("" means no password). Length: 0–32 bytes. Recommended: 4–8 digits for easy input. Once set, others must enter the password to join. Don’t store sensitive info in plain text. |
isAllMicrophoneDisabled | Boolean | No | Disable microphones for all participants. Only the room owner/admin can enable microphones; others are restricted: true: Disabled. false: Not disabled (default). |
isAllCameraDisabled | Boolean | No | Disable cameras for all participants. Only the room owner/admin can enable cameras; others are restricted: true: Disabled. false: Not disabled (default). |
isAllScreenShareDisabled | Boolean | No | Disable screen sharing for all participants. Only the room owner/admin can share screens: true: Disabled. false: Not disabled (default). |
isAllMessageDisabled | Boolean | No | Disable chat messages for all participants (mute) Regular participants cannot send text messages: true: Disabled. false: Not disabled (default). |
RoomMainView as a participant.RoomMainView lazily.onCreate, add RoomMainView and use layout to fill the view.import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.roomkit.view.RoomMainView// MainActivity represents the Activity where you load the room main pageclass MainActivity : AppCompatActivity() {// 1 Load the room creation viewprivate val roomView: RoomMainView by lazy {RoomMainView(this).apply {// 2 Build room entry configurationval config = RoomMainView.ConnectConfig(autoEnableMicrophone = true, // Automatically enable microphone upon enteringautoEnableCamera = true, // Automatically enable camera upon enteringautoEnableSpeaker = true // Automatically enable speaker upon entering)val behavior = RoomMainView.RoomBehavior.Join// 3 Initialize the room main pageinit("roomID", behavior, config)}}override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// 4. Add the view to the ActivitysetContentView(roomView)}}
RoomMainView, you gain a complete multi-party audio/video conference page with member management, device controls, and room information display. These are the core features provided by TUIRoomKit.
RoomMainView page offers rich features and high customizability. Adjust the UI to meet your product requirements and business scenarios. Below are the main view components in RoomMainView to help you quickly identify areas for customization.
Component | Function Description | Customization Suggestions |
Serves as the primary container for the room, managing layout and data flow across all child components. | Allows customization of the overall background, adapts to device safe areas, and controls component visibility logic. | |
Provides the top navigation bar, displaying room details, camera and audio controls, and access to Exited Room. | Customize icon sets, adjust background transparency, and add additional buttons such as recording or windowed mode. | |
Displays video streams using a waterfall layout to efficiently manage multiple user feeds. | Adjust layout logic including the number of rows and columns, spacing, page indicator styles, and empty state visuals. | |
Renders individual video cells, showing user video feeds alongside basic user information. | Customize the video rendering layer, user info panel (such as avatar and badge), and add interactive elements like voice waveforms. | |
Acts as the bottom toolbar, grouping microphone, camera, and member management controls. | Rearrange button order, update button styles (color, size), and add features such as screen sharing, in-room calling, or beauty effects. |

Icon | Filename | Description |
![]() | roomkit_ic_camera_off.png | Camera off icon |
![]() | roomkit_ic_camera_on.png | Camera on icon |
![]() | roomkit_ic_microphone_off.png | Microphone off icon |
![]() | roomkit_ic_microphone_on.png | Microphone on icon |
![]() | roomkit_icon_user_room_manager.png | Microphone on icon |
![]() | roomkit_ic_video_seat_owner.png | Room owner icon |

LoginStore.shared.login once. We recommend tying LoginStore.shared.login and LoginStore.shared.logout to your own login/logout business logic.FOREGROUND_SERVICE, FOREGROUND_SERVICE_CAMERA, and FOREGROUND_SERVICE_MICROPHONE permissions and services in AndroidManifest.xml.<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /><uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" /><uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" /><serviceandroid:name=".MediaCaptureService"android:foregroundServiceType="camera|microphone" />
import android.app.NotificationChannelimport android.app.NotificationManagerimport android.app.Serviceimport android.content.Intentimport android.content.pm.ServiceInfoimport android.os.Bundleimport android.os.IBinderimport androidx.appcompat.app.AppCompatActivityimport androidx.core.app.NotificationCompatclass MainActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)startForegroundService(Intent(this, MediaCaptureService::class.java))}}class MediaCaptureService : Service() {override fun onCreate() {super.onCreate()// 1. Create notification channelval channel = NotificationChannel("media", "Media Capture", NotificationManager.IMPORTANCE_LOW)getSystemService(NotificationManager::class.java).createNotificationChannel(channel)// 2. Build notificationval notification = NotificationCompat.Builder(this, "media").setContentTitle("In audio/video call").setSmallIcon(android.R.drawable.ic_menu_call).build()// 3. Start foreground service, specify camera and microphone types (required for Android 14+)startForeground(1, notification,ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE)}override fun onBind(intent: Intent?): IBinder? = null}
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan