Add the Chat Android SDK to your app
Add the SDK
Using Gradle
- Open your application level 'build.gradle'
- Add the 'Chat' gradle dependency
implementation 'com.arena:chat:1.0.0'
- Sync your project
Using Maven
<dependency>
<groupId>com.arena</groupId>
<artifactId>chat</artifactId>
<version>1.0.0</version>
</dependency>
Install the Chat SDK
Installing the Chat SDK is simple if you’re familiar with using external libraries or SDKs. To install the Chat SDK using Gradle, add the following lines to a build.gradle file at the app level.
repositories {
mavenCentral()
}
dependencies {
implementation 'im.arena:chat:1.0.0'
}
Configure ProGuard to shrink code and resources
When you build your APK with minifyEnabled true, add the following line to the module's ProGuard rules file.
-keep class im.arena.chat.** { *; }
Setup SDK
To initialize the SDK, you'll need the SITE_ID and ROOM_ID, both available in the Arena Dashboard or using the Platform API.
You can find your site's slug in the dashboard settings: https://dashboard.arena.im/settings/site.
After retrieving the SITE_ID and ROOM_ID, you need to call ArenaChat(SITE_ID, ROOM_ID). This method should be called once in your Android client application. It's recommended to initialize the Activity's onCreate() method. The chat has additional settings that allow clients to view event logs in the terminal, as well as change the running environment:
setContent {
ArenaChat(SITE_ID, ROOM_ID, Environment.DEVELOPMENT)
}
SITE_ID: Account ID ROOM_ID: Chat ID
The chat internally uses Android's Compose, which allows customers to add and customize the screen where the chat will be embedded. After these steps, the chat will be up and running in your app.
Updated 3 days ago