Run Demo

This guide provides step-by-step instructions to help you quickly get started with the Chat Demo and explore features including text, voice, and video messaging. After setup, the Demo app interface appears as shown below:
Login Page
Conversation List
Chat Page










Demo App

You can go to Free Demo to download the Chat Demo app to explore the full range of instant messaging features.

Prerequisites

Enable the Service

1. Log in to the Console. If you already have an Application, save your SDKAppID and SDKSecretKey and skip to Environment Preparation.
2. Click Create Application, enter your Application name, select Chat as the product, choose your region, and click Create to add the Application.

3. After creation, you can view your Application’s SDKAppID and SDKSecretKey on the Console Overview page. You will need this information to run the Demo.

Forbidden:
Secure your SDKSecretKey to protect your Application from unauthorized access.

Environment Preparation

Before you begin, ensure you meet the following requirements:
Android Studio 2022.3.1 or later
A physical device or emulator running Android 5.0 or higher
A valid Chat Application. Refer to the “Enable the Service” section above to obtain or create one.
Version Compatibility Note:
To ensure a stable build environment, strictly follow official compatibility requirements:
For compatibility between Gradle, Android Gradle Plugin, JDK, and Android Studio, see the official Android documentation: Version Notes
For version mapping between Kotlin, Android Gradle Plugin, and Gradle, see the official Kotlin documentation: Kotlin-Gradle Plugin Compatibility
We recommend selecting a version combination that matches your project requirements based on the above guidelines.

Instructions

Get the Demo

Note:
This demo uses TRTC's emoji pack with restricted licensing.
Commercial Usage Options
Option A: Keep Our Emoji (Recommended)
Upgrade to Chat Pro Plus or Enterprise Plan and use our emoji pack at no additional cost.
Option B: Use Your Own
Replace the default emoji with your own custom designs, or use emoji packs with proper commercial licensing.


2. Open the project directory in your terminal and locate the GenerateTestUserSig.java file at Demo/app/src/main/java/com/tencent/qcloud/tim/demo/signature/GenerateTestUserSig.java.
3. Configure the following parameters in the GenerateTestUserSig.java file:
SDKAPPID: Set this to your actual SDKAppID obtained above.
SECRETKEY: Set this to your actual SecretKey obtained.
Warning:
1. In this Demo, authentication is performed by configuring the SECRETKEY in the client code. However, the SECRETKEY can be easily extracted through reverse engineering. If leaked, attackers could misuse your Tencent Cloud resources. This approach is suitable only for local Demo trials and feature debugging.
2. For production environments, we strongly recommend generating the UserSig on your server. When your app needs a UserSig, it should request a dynamic UserSig from your business server for authentication. For details, see Generating UserSig on the Server.

Build and Run the Demo

Open Android Studio and launch the Demo directory.
Note:
The first time you import the Demo project, dependencies will be downloaded automatically. Wait until the download and synchronization are complete before running the project.
To run on an Android device:
1. Connect your Android device to your computer, enable Developer Mode and USB Debugging on the device, and set USB mode to File Transfer if required.
2. Set the Gradle JDK:
In Android Studio, go to Settings > Build, Execution, Deployment > Build Tools > Gradle.
In the Gradle JDK dropdown, select JDK 11 (install JDK 11 if it is not available). Then, run File > Sync Project with Gradle Files to verify the configuration.
3. In the Android Studio toolbar, select your test Android device from the Running devices dropdown.

4. Click the Run button to build the project. Once the build succeeds, the Tencent Cloud IM App will be installed automatically on your device.
5. Open the app and enter any userID to create and log in to a user account.


Experience Basic Features

​To experience the basic features, follow these steps after running the demo successfully.​

Create a User Account

To create a user account, choose one of the following methods:
Client Registration
Console Registration
Enter a userID in the Demo and log in.
1. Click to enter the Application you created. In the left sidebar, click the Chat product entry to enter.
2. On the Chat product subpage, click Users to open the user management page.
3. Click Create account to open the account creation dialog. For regular users, select the General type. While Nickname is optional, we recommend setting it. If displaying userID is not ideal in your UI, use Nickname to distinguish users.
Illustration:

Note:
Messaging requires at least two users. Create at least two accounts at this stage, and record their userIDs for the next steps.

Add Contacts

To add contacts:
1. On the Contacts page, click the + button in the upper right corner and select Add to Contacts from the submenu.
2. Enter a valid userID to search for the user. If you created accounts in the Console, obtain valid userIDs from the Console’s Account Management page. Path: Applications > Your App > Chat > Users > Account Management.
3. Add a user as a contact.
Tap Add to Contacts
Search for User
Send Contact Request









After adding a user successfully, the contact list displays the user you just added:




Send Messages

Select a user, click Message to enter the chat interface:



You can now exchange text, voice, images, and audio/video calls with this user:




Contact Us

If you have any questions or suggestions, feel free to join our Telegram or WhatsApp community, or contact us for support.