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
│ ├── AUIBaseKits
│ ├── AUIAICall
│ ├── AUIAICallEngine
│ ├── ARTCAICallKit
│ ├── README.md
│ ├── app
│ ├── build.gradle
│ └── settings.gradle
Environment requirements
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.
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
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.
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'
implementation 'com.google.android.material:material:x.x.x'
androidTestImplementation 'androidx.test.espresso:espresso-core:x.x.x'
implementation 'com.aliyun.aio:AliVCSDK_ARTC:x.x.x'
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.
After the build.gradle file is synchronized, the source code is integrated into your project.
Configure the source code
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.
ARTCAICallEngine.ARTCAICallAgentType aiCallAgentType =
ARTCAICallEngine.ARTCAICallAgentType.VoiceAgent;
String aiAgentId = "";
Context currentActivity = AUIAICallEntranceActivity.this;
Intent intent = new Intent(currentActivity, AUIAICallInCallActivity.class);
intent.putExtra(AUIAICallInCallActivity.BUNDLE_KEY_LOGIN_USER_ID, "xxx");
intent.putExtra(AUIAICallInCallActivity.BUNDLE_KEY_AI_AGENT_TYPE, aiCallAgentType);
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.
