All Products
Search
Document Center

ApsaraVideo Live:Run ARTC demo project for Android

Last Updated:Dec 23, 2025

This topic describes how to run the demo project of ApsaraVideo Real-time Communication (ARTC) to try out ARTC features on Android.

Download source code

ApsaraVideo Live provides open-source sample projects to demonstrate the API usage of ARTC SDK, helping developers understand and integrate the ARTC features. To download the source code, visit GitHub repository.

Environment requirements

Before running the demo project, ensure your development environment meets the following requirements:

  • Development tool: Android Studio 2020.3.1 or later.

    • Recommended: Android Studio 2024.1.2 or later, Android Gradle Plugin (AGP) version 8.6.0, Gradle version 8.7, JDK 17.

      Note

      Using earlier versions of Android Studio may cause compatibility issues with AGP. If you encounter compilation failures, downgrade your AGP, Gradle, and JDK versions. For more information, refer to Android Gradle plugin and Android Studio compatibility.

  • Test device: A device running Android 5.0 (API Level 21) or later.

    Note

    We recommend using physical devices for testing, as emulators may not support all features.

  • Network: A stable Internet connection.

  • Application setup: Obtain the AppID and AppKey of the ARTC application.

Procedure

Step 1: Get the demo project

Clone the ARTC demo project to your local device:

git clone https://github.com/MediaBox-Demos/amdemos-artc
Note

This repository contains demo projects for multiple native platforms. The Android demo project is located in the Android/ARTCExample directory.

The demo project includes code for generating tokens on the client side. This is for demonstration and testing purposes only. In a production environment, tokens must be generated on a secure server to protect your AppKey.

File structure of the Android/ARTCExample project:

├── Android       		       // Root directory for the Android project
│   ├── ARTCExample            // Main project for the API Examples
│       ├── app                // Demo app
│       ├── KeyCenter          // AppId and AppKey configuration
│           ├── keycenter      // Sets your AppId and AppKey
│       ├── quickstart         // Quick start module
│           ├── TokenGenerate  // Generates a token and joins a channel
│           ├── VideoCall      // Implements a video call
│           ├── VoiceChat      // Implements a voice chat room
│       ├── BasicUsage          // Basic features module
│           ├── AudioBasicUsage  // Common audio operations and configurations
│           ├── VideoBasicUsage // Common video operations and configurations
│           |—— CameraCommonControl // Common camera controls
│           |—— SEIUsage         // SEI message sending and receiving
│           |—— DataChannelMessage // Custom message sending and receiving
│           |—— ScreenShareUsage  // Screen sharing
│           |—— StreamMonitoring // In-call stream quality monitoring
            |—— PlayAudioFiles    // Plays audio accompaniment and sound effects
        |—— AdvancedUsage // Advanced features module
            |—— ProcessAudioRawData // Raw audio data Processing
            |—— ProcessVideoRawData // Raw video data Processing
            |—— CustomAudioCaptureAndRender // Custom audio capture and rendering
            |—— CustomVideoCaptureAndRender // Custom video capture and rendering
            |—— PreJoinChannelTest // Device and network quality tests before joining a channel
            |—— PictureInPicture // Picture-in-Picture
            |—— H265 // H.265 codec         
            |—— IntelligentDenoise // Intelligent noice reduction            
            |—— LocalRecord     // Local recording           
│       ├── build.gradle  
│       └── settings.gradle

Step 2: Configure the demo project

  1. Open the Android/ARTCExample directory in Android Studio.

  2. Configure the project's AppID and AppKey: Navigate to the Android/ARTCExample/KeyCenter/src/main/java/com/aliyun/artc/api/keycenter/ARTCTokenHelper.java file and enter the AppID and AppKey obtained from the ApsaraVideo Live console.

// ARTCTokenHelper.java
// AppID of your ARTC application
private static String AppId = "<AppID>";
// AppKey of your ARTC application
private static String AppKey = "<AppKey>";

image

Step 3: Compile and run the demo project

Enable Developer Options on your Android test device and connect it to your local device. Select your device from the list of available devices in Android Studio.

image

  1. In Android Studio, click Sync Project with Gradle Files.

  2. After the sync is successful, click Run 'app' to compile the project. When the build completes, the ARTCExample application is installed on your device.

On the test device, open the application and tap Video Call to test this feature.

image

To test video call, use the same channel ID to join the call on two devices.

image

The call starts, and you can see the video streams from both devices.

image