This guide provides step-by-step instructions to help you quickly get started with the Chat Demo and explore features such as text, voice, and video messaging. After completing setup, the Demo app interface appears as follows:
Quick Experience
Visit Try Demo to test the Chat Demo across multiple platforms. Prerequisites
Activate the Service
1. Log in to the Console. If you already have an application, get your SDKAppID and SDKSecretKey, then proceed to the next section. 2. Click Create Application, enter your application name, select Product and Region, then click Create.
3. After creation, view your SDKAppID and SDKSecretKey on the Console Overview page. You will use these values to run the Demo.
Prohibited:
Keep your SDKSecretKey confidential to prevent unauthorized access.
Environment Preparation
Flutter version >= 3.29.0
Dart version >= 3.7.0
Android Studio Dolphin | 2021.3.1 or later
Android Gradle plugin version 7.3.1 or later
Xcode version 12.0 or later
Version Compatibility Note:
To ensure a stable build environment, strictly follow official compatibility requirements:
For Gradle, Android Gradle Plugin, JDK, and Android Studio compatibility, refer to Version Notes. If Android Studio uses a higher default JDK version, compilation may fail. Use JDK 17. See Java Version Switching. We recommend choosing a version combination that matches your project requirements.
Instructions
Get the Demo
Tip:
This demo uses TRTC's emoji pack with restricted licensing.
Commercial Usage Options
Option A: Keep Our Emoji (Recommended)
Option B: Use Your Own
Replace the default emoji with your own custom designs, or use emoji packs with proper commercial licensing.
1. Download the Demo source code and install dependencies:
git clone https://github.com/TencentCloud/chat-demo-flutter.git
cd chat-demo-flutter
git checkout v2
flutter clean
flutter pub get
2. Configure the following parameters in the config file:
sdkAppID: Set to your actual SDKAppID.
key: Set to your actual SDKSecretKey.
Caution:
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
Import the project into Android Studio and install the Flutter and Dart plugins.
To run on an Android device:
Connect your device to your computer, enable Developer Mode, turn on USB debugging, and select USB for file transfer if needed.
In Android Studio, select your test device from Running devices.
Click the run button to build and deploy. After a successful build, the Tencent Cloud Chat App installs automatically on your device.
Launch the app and enter any UserID to create and log in to an account.
Experience Basic Features
After successfully setting up the Demo, follow these steps to explore its core features.
Create a User Account
Create a UserID using one of the following methods:
Enter a UserID in the Demo and log in.
Steps:
1. Open the application you created. In the left sidebar, click the Chat product entry.
2. On the Chat product subpage, click Users to access user management.
3. Click Create account to open the account creation dialog. For regular members, select the General type. Setting a Nickname is optional but recommended. If the interface does not clearly display UserID, you can use Nickname to distinguish users.
As shown below:
Note:
You'll need at least two users to test sending and receiving messages. Create at least two accounts and record their userIDs for later steps.
Add Contacts
On the Contacts page:
1. Click the + button in the top right, then select Add to Contacts.
2. Enter a valid UserID to search for users. If you created accounts in the Console, you can find UserIDs in Console > Applications > Your App > Chat > Users > Account Management.
3. Add the user as a contact.
Steps illustrated below:
After adding new contacts, the contact list displays the user you just added:
Send Messages
Select a user and click Message to enter the chat interface:
You can now send text, voice, images, and start audio or video calls with this user:
FAQs
Which data centers support speech-to-text in the Demo?
Speech-to-text is currently supported only for SDKAppIDs in the China data center.
Contact Us