This topic describes how to integrate AUI Kits for chit-chat rooms with an Android application.
Source code
Download link
You can download the source code from GitHub.
Directory structure
The source code contains the AUIBaseKits and AUIVoiceRoomEngine components. Directory structure:
├── Android
│ ├── AUIBaseKits // The basic component of AUI Kits.
│ ├── AUIVoiceRoom // The UI component.
│ ├── AUIVoiceRoomEngine // The scenario-based API operations.
│ ├── README.md
│ ├── app // The demo.
│ ├── build.gradle
│ └── settings.gradle Environment requirements
Android Studio 4.1.3
Gradle 7.0.2
Java Development Kit (JDK) 11 in Android Studio
Prerequisites
An application is created. The server-side API operations are developed or directly deployed from the source code. For more information, see Integrate and run AUI Kits AppServer for chit-chat rooms.
Integrate the component
To integrate the chit-chat room feature into your Android project, you need to only integrate the AUIVoiceRoomEngine component into the project.
Configure your project
Import the AUIVoiceRoomEngine component.
After you download the source code from the GitHub repository, open Android Studio, choose File > New > Import Module, and then import the AUIKaraokeRoomEngine folder.
Open the build.gradle file in the folder and modify the third-party dependencies. Sample code:
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_Standard:x.x.x' // Replace x.x.x with a version that is adapted to your project. }After the build.gradle file is synchronized, the source code is integrated into your project.
Modify the source code
Open the VoiceRoomServerConstant.java file and specify the domain name of your server.
// VoiceRoomServerConstant.java public static final String HOST = "The domain name of your server";Open the VoiceRoomServerConstant.java file and specify the ID of your Alibaba Real-Time Communication (ARTC) application.
// VoiceRoomServerConstant.java public static final String APP_ID = "The ID of your ARTC application.";
Call API operations
After the preceding steps are complete, you can call the API operations for chit-chat rooms in other modules of your application or on the homepage of your application to use the chit-chat room feature. You can also modify the source code based on your business requirements. For more information, see the source code in which the ARTCVoiceRoomEngine component is called in the AUIVoiceRoom component.