Integrate AUI Kits for AI real-time interaction with Android apps

Updated at: 2025-03-05 09:15

This topic describes how to integrate AUI Kits for AI real-time interaction with an Android app.

Source code

Source code download

You can download the source code from GitHub.

Source code structure

├── Android       // The root directory of the Android platform.
│   ├── AUIBaseKits     // The basic component of AUI Kits.
│   ├── AUIAICall       // The UI components.
│   ├── AUIAICallEngine // The basic API to implement AI real-time interaction scenarios.
│   ├── ARTCAICallKit   // The fully managed API to implement AI real-time interaction scenarios.
│       ├── README.md
│   ├── app             // The demo.
│ ├── build.gradle  
│ └── settings.gradle 

Environment requirements

  • Android Studio plug-in 4.1.3

  • Gradle 7.0.2

  • Java Development Kit (JDK) 11 in Android Studio

Prerequisites

The relevant API operations are developed on your AppServer or the AppServer is deployed based on the source code. For more information, see Integrate AUI Kits AppServer for AI real-time interaction.

Run the demo

  • After the source code is downloaded, start Android Studio and open the Android directory.

  • Modify the package ID in the build.gradle file.

  • Modify the domain name of the AppServer in the AppServiceConst.java file.

    // AppServiceConst.java
    String HOST = "The domain name of your AppServer.";

Quick integration

You can quickly integrate AUIAICall into your app and implement the AI real-time interaction feature by performing the following steps:

Integrate the source code

  1. Import AUIAICall. After you download the source code from the GitHub repository, open Android Studio, choose File > New > Import Module, and then import the AUIAICall folder.

  2. Modify the following dependencies on third-party libraries in the build.gradle file of the AUIAICall folder.

    dependencies {
        implementation 'androidx.appcompat:appcompat:x.x.x'                     // Replace x.x.x with a version that is adapted to your project.
        implementation 'com.google.android.material:material:x.x.x'             // Replace x.x.x with a version that is adapted to your project.
        androidTestImplementation 'androidx.test.espresso:espresso-core:x.x.x'  // Replace x.x.x with a version that is adapted to your project.
        implementation 'com.aliyun.aio:AliVCSDK_ARTC:x.x.x'                  // Replace x.x.x with a version that is adapted to your project.
        implementation 'com.aliyun.auikits.android:ARTCAICallKit:1.4.0'
    }
    Note

    You can go to the official website to download ARTC SDK of the latest version.

  3. After the build.gradle file is synchronized, the source code is integrated into your project.

Configure the source code

  • Make sure that all prerequisites are met.

  • Modify the domain name of the AppServer in the AppServiceConst.java file.

    // AppServiceConst.java
    String HOST = "The domain name of your AppServer.";

Call API operations

After the preceding steps are complete, you can call API operations of AI real-time interaction in other modules of your app or on the homepage of your app to integrate the AI call feature with your app. You can also modify the source code based on your business requirements.

/** Make sure that you are authorized to use the microphone and camera. */

// The type of the intelligent agent.
ARTCAICallEngine.ARTCAICallAgentType aiCallAgentType = 
    ARTCAICallEngine.ARTCAICallAgentType.VoiceAgent;
// The ID of the intelligent agent.
String aiAgentId = "";
Context currentActivity = AUIAICallEntranceActivity.this;
Intent intent = new Intent(currentActivity, AUIAICallInCallActivity.class);

// Enter the ID of the user who joins the Real-Time Communication (RTC) channel. We recommend that you enter the ID of the user who logs on to the RTC console.
intent.putExtra(AUIAICallInCallActivity.BUNDLE_KEY_LOGIN_USER_ID, "xxx");
// The type of the intelligent agent.
intent.putExtra(AUIAICallInCallActivity.BUNDLE_KEY_AI_AGENT_TYPE, aiCallAgentType);
// The ID of the intelligent agent.
intent.putExtra(AUIAICallInCallActivity.BUNDLE_KEY_AI_AGENT_ID, aiAgentId);

currentActivity.startActivity(intent);

FAQ

To obtain more information about and technical support for AUI Kits, scan the following QR code by using DingTalk to join the AUI Kits user group.

02e499c493677805c1e0601c5fbc9273

  • On this page (1, O)
  • Source code
  • Source code download
  • Source code structure
  • Environment requirements
  • Prerequisites
  • Run the demo
  • Quick integration
  • Integrate the source code
  • Configure the source code
  • Call API operations
  • FAQ
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare