• SDK
  • Server Features & APIs
RTC Engine/
SDK/
Android/
SDK
  • Overview
    • Product Introduction
    • Product Information
      • Product Concepts
      • Feature Overview
      • Performance Statistics
    • Pricing
      • Free Minutes
      • RTC-Engine Monthly Packages
      • Billing Explanation for Subscription Package Duration
      • Pay-as-you-go
        • Billing of Audio and Video Duration
        • Billing of On-Cloud Recording and Recording Delivery
        • Billing of MixTranscoding and Relay to CDN
  • Run Sample Code
  • Integration
  • Basic Features
    • Detect Network Quality
    • Enabling Screen Sharing
    • Setting Video Quality
    • Rotating Videos
    • Live Streaming
    • Managing Media Devices
    • Adjusting Volume
  • Advanced Features
    • Custom Capturing and Rendering
    • Custom Audio Capturing and Playback
    • Sending and Receiving Messages
    • Enabling Beauty and Effects
    • Playing Background Music
    • Video Screenshot Upload
    • AI Noise Suppression
  • Client APIs
    • Overview
    • TRTCCloud
    • TRTCStatistics
    • TRTCCloudListener
    • TXAudioEffectManager
    • TXBeautyManager
    • TXDeviceManager
    • Type Definition
    • Deprecated Interface
    • Error Codes
  • Solution
    • Real-Time Chorus (TUIKaraoke)
      • Quick Integration
      • Implementation Steps
      • Song Synchronization
      • Lyric Synchronization
      • Vocal Synchronization
      • Mixing Stream Solution
      • TRTCKaraoke APIs
      • FAQs
  • FAQs
    • All platforms
      • FAQs for Beginners
      • Migration Guide
        • Twilio Video to Tencent RTC
        • Billing
        • Features
        • UserSig
        • Firewall Restrictions
        • How to Downsize Installation Package
        • TRTCCalling for Web
        • Audio and Video Quality
        • Others
    • Released Notes

Run Sample Code

This document describes how to quickly run the demo for the TRTC Android SDK.

Prerequisites

Android 4.1 (SDK API level 16) or later; Android 5.0 (SDK API level 21) or later is recommended.
Android Studio 3.5 or later.
Devices with Android 4.1 or later.

Steps To Run Demo

Step 1. Download the Demo

Download the Andorid sample demo code on github which SDK has been imported into sample project, or run the following command in a terminal:

Step 2. Configure the Demo

1. Log in to the TRTC Console and click Create Application. If you have already done so, you may skip this step.
2. And then, your own SDKAppID and SDKSecretKey of your created application can be obtained in the Basic Information section.



3. Replace the values of SDKAPPID and SDKSECRETKEY in GenerateTestUserSig under TRTC-API-Example/Debug/src/main/java/com.tencent.trtc.debug directory with the information obtained in Step 2.



Note:
In the demo above, we used SDKSecretKey to generate UserSig locally in order to help you go through the demo easier. However, in the production environment, you are not supposed to generate userSig in this way, which may lead to SDKSecretKey leakage, thereby creating a chance for attackers to steal your TRTC traffic. The correct way to generate UserSig is to integrate Server-Side Generation of UserSig on your server. When an user enters the room:
Send a http request to your server.
Generate a UserSig on your server.
Return it to the user to enter the room.
When you deploy your page to a production environment, you need to have your page accessed through the HTTPS(e.g. https://domain/xxx). For the reason, please refer to the document Page Access Protocol Restriction Description.

Step 3. Run the Demo

Open TRTC-API Example with Android Studio(v3.5 or later) and get it run.

Step 4. Experience the Demo

You can choose the functions you are interested in to experience.




FAQs

If you encounter any problems with access and use, please refer to FAQs.
If you have any requirements or feedback, you can contact: info_rtc@tencent.com.
Ask the community!
Start technical discussions and get instant expert support!