Conversation List | Chat | Audio/Video Call |
![]() | ![]() | ![]() |
npx @tencent-rtc/trtc-agent-skills add --ide <your IDE> in the project root directory to install trtc-agent-skills into your local AI IDE to assist with TUIKit integration (<your IDE> can be replaced with cursor, codebuddy, claude, or codex, or use all to install all of them). After installation, you can give the AI requests such as "Integrate Android Chat", "Add a custom message type", or "Switch between light and dark themes". Based on your project type, the AI will guide you through code integration, API calls, UI style modification, and test data generation. For details, see AI Coding Skills.git clone https://github.com/Tencent-RTC/TUIKit_Android.git
chat, call, and atomic_x folders from the repository root directory to the root directory of your project. The directory structure after copying is as follows:YourApplication/├── app/ # Your app module├── atomic_x/ # Base UI component library├── call/ # Audio/video call component│ └── tuicallkit-kt/├── chat/ # Chat source code│ ├── demo/ # Demo project│ └── uikit/ # Chat UIKit component library├── settings.gradle.kts└── build.gradle.kts
chat/ directory (chat/uikit is the UIKit component library, and chat/demo is the demo project). The base component atomic_x and the audio/video call component call/tuicallkit-kt that it depends on are located in the repository root directory. You can place the module directories anywhere in your project, as long as you set the correct relative paths in settings.gradle.kts.settings.gradle.kts. Adjust the relative paths based on where you actually place the source code:// settings.gradle.ktsinclude(":atomic_x")project(":atomic_x").projectDir = file("${settingsDir.path}/atomic_x")include(":uikit")project(":uikit").projectDir = file("${settingsDir.path}/chat/uikit")include(":tuicallkit-kt")project(":tuicallkit-kt").projectDir = file("${settingsDir.path}/call/tuicallkit-kt")
// settings.gradleinclude ':atomic_x'project(':atomic_x').projectDir = new File(settingsDir, 'atomic_x')include ':uikit'project(':uikit').projectDir = new File(settingsDir, 'chat/uikit')include ':tuicallkit-kt'project(':tuicallkit-kt').projectDir = new File(settingsDir, 'call/tuicallkit-kt')
build.gradle.kts:// app/build.gradle.ktsdependencies {implementation(project(":atomic_x"))implementation(project(":uikit"))implementation(project(":tuicallkit-kt"))}
// app/build.gradledependencies {implementation project(':atomic_x')implementation project(':uikit')implementation project(':tuicallkit-kt')}

login API of LoginStore and pass in the sdkAppID, userID, and userSig obtained above for login authentication:import io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.login.LoginStoreimport com.tencent.cloud.tuikit.engine.call.TUICallEngineimport com.tencent.cloud.tuikit.engine.common.TUICommonDefineLoginStore.shared.login(context,sdkAppID, // Int, obtained from the ConsoleuserID, // StringuserSig, // String, generated in the Console or on your serverobject : CompletionHandler {override fun onSuccess() {// Login succeededTUICallEngine.createInstance(context).init(sdkAppID, userID, userSig,object : TUICommonDefine.Callback {override fun onSuccess() {// Initialization succeeded. You can use audio/video call features.}override fun onError(errCode: Int, errMsg: String) {// Initialization failed}})}override fun onFailure(code: Int, desc: String) {// Login failed. You can show an error dialog.}})
ChatPageView to display and send or receive messages. Pass conversationID through setup. The conversationID format is c2c_<peer UserID> for one-to-one chats and group_<GroupID> for group chats.import android.content.Contextimport android.content.Intentimport android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport io.trtc.tuikit.chat.uikit.pages.ChatPageViewclass ChatActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// conversationID format: "c2c_<peer UserID>" for one-to-one chats, "group_<GroupID>" for group chatsval conversationID = intent.getStringExtra("conversationID") ?: returnval chatPageView = ChatPageView(this)chatPageView.setup(conversationID = conversationID)setContentView(chatPageView)}companion object {fun start(context: Context, conversationID: String) {context.startActivity(Intent(context, ChatActivity::class.java).apply {putExtra("conversationID", conversationID)})}}}
ChatActivity, a chat page encapsulated based on ChatPageView with a title bar, unread badges, group event handling, and more. You can reuse it directly or refer to its implementation for customization: ChatActivity.start(context, conversationID).TUICallEngine to use audio/video call features in TUIKit components.import com.tencent.cloud.tuikit.engine.call.TUICallEngineimport com.tencent.cloud.tuikit.engine.common.TUICommonDefine// Initialize TUICallEngine in the LoginStore login success callback in Step 2TUICallEngine.createInstance(context).init(sdkAppID, userID, userSig,object : TUICommonDefine.Callback {override fun onSuccess() {// Initialization succeeded. You can use audio/video call features.}override fun onError(errCode: Int, errMsg: String) {// Initialization failed}})
com.tencentcloud.desk:aideskcustomer package as described in Integrating the Desk Customer Client on Android. You can then add customer service conversations to your app.int SDKAppID = 0; // The ID of the application with AI Customer Service Desk activatedString userID = "";String userSig = "";// The preceding three parameters can be the same as those used to log in to Tencent Cloud Chat, or you can use a different application and user.// User nickname. After it is set, a human agent can see it in the workbench when the user is successfully transferred to a human agent. You can write information such as the user's phone number and source into the nickname. Maximum length: 500 bytes.// Note: After it is set, the nickname of the same userID in Chat is also updated.// If you do not want to change it, set it to "" or null.String nickName = "";// User avatar. After it is set, a human agent can see it in the workbench when the user is successfully transferred to a human agent.// Note: After it is set, the avatar of the same userID in Chat is also updated.// If you do not want to change it, set it to "" or null.String avatar = "";TencentAiDeskCustomer.getInstance().initWithProfile(context, SDKAppID, userID, userSig, nickName, avatar, new AIDeskCallback() {@Overridepublic void onSuccess() {startActivity(TencentAiDeskCustomer.getInstance().getCustomerServiceChatIntent(context));}@Overridepublic void onError(int code, String desc) {}});
tuicallkit-kt dependency from settings.gradle.kts (or settings.gradle) and the build.gradle.kts (or build.gradle) file of the app module, and turn off the audio/video call switches in Step 3. Build the Chat UI, as shown in the following code:val messageInputConfig = ChatMessageInputConfig(isShowAudioCall = false, // Disable voice callsisShowVideoCall = false // Disable video calls)val chatPageView = ChatPageView(this)chatPageView.setup(conversationID = conversationID,messageInputConfig = messageInputConfig)

Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários