Add Android SDK to your app
Add the SDK
Using Gradle
Add the following dependencies to your app-level build.gradle.kts:
implementation("im.arena:comment-system-android:1.0.1-alpha03")
implementation("im.arena:common-android:1.0.1-alpha03")
implementation("im.arena:auth:1.0.1-alpha03")
After adding the dependencies, sync your project.
Install the Comment System SDK
Installing the Comment System SDK is simple if you’re familiar with using external libraries or SDKs. To install the Comment System SDK using Gradle, add the following lines to a build.gradle file at the app level.
repositories {
mavenCentral()
}
dependencies {
implementation 'im.arena:commentsystem:1.0.0'
}Configure ProGuard to shrink code and resources
If you build your APK with minifyEnabled true, add the following rule to your proguard-rules.pro file:
-keep class im.arena.commentsystem.** { *; }
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,
- THREAD_ID
- THREAD_PROFILE_ID
- URL
- PAGE_TITLE
Initialize authentication. Call this in your Activity (recommended inside onCreate()):
AuthManager.initialize(this, GOOGLE_CLIENT_ID)Add the Comment System to your layout. Place the ArenaCommentSystem composable wherever you want the comments UI to appear:
ArenaCommentSystem(
ContextFactory(this),
SITE_ID_COMMENT_SYSTEM,
URL,
NAME,
PAGE_TITLE,
THREAD_ID,
THREAD_PROFILE_ID
)Below is a complete working example of an Android Activity using Jetpack Compose and the Arena Comment System SDK. All sensitive keys are intentionally hidden.
package com.example.arenacomments
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import im.arena.auth.AuthManager
import im.arena.commentsystem.ArenaCommentSystem
import im.arena.commentsystem.Environment
import im.arena.common.ContextFactory
class MainActivity : ComponentActivity() {
companion object {
private const val SITE_ID_COMMENT_SYSTEM = "YOUR_SITE_ID"
private const val NAME = "Test"
private const val THREAD_ID = "YOUR_THREAD_ID"
private const val GOOGLE_CLIENT_ID = "YOUR_GOOGLE_CLIENT_ID"
private const val URL = "YOUR_PAGE_URL"
private const val PAGE_TITLE = "Your Page Title"
private const val THREAD_PROFILE_ID = "YOUR_THREAD_PROFILE_ID"
}
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContent {
AuthManager.initialize(
this,
GOOGLE_CLIENT_ID
)
MaterialTheme {
Scaffold(
modifier = Modifier.fillMaxSize()
) { contentWindowInsets ->
Box(
modifier = Modifier
.fillMaxSize()
.padding(
top = contentWindowInsets.calculateTopPadding(),
bottom = contentWindowInsets.calculateBottomPadding()
)
.consumeWindowInsets(contentWindowInsets),
contentAlignment = Alignment.Center
) {
ArenaCommentSystem(
ContextFactory(this@MainActivity),
SITE_ID_COMMENT_SYSTEM,
URL,
NAME,
PAGE_TITLE,
THREAD_ID,
THREAD_PROFILE_ID,
Environment.DEVELOPMENT
)
}
}
}
}
}
}The Comment System is built using Jetpack Compose, allowing full UI customization and flexible screen embedding. Initialization should occur once per Activity lifecycle.
Updated 5 days ago