Android SDK (Gradle, Compose)

Jetpack Compose UI, OkHttp SSE/WebSocket, EncryptedSharedPreferences. minSdk 24.

Gradle dependency

kotlin
dependencies {
    implementation("app.supportal:sdk:0.1.0")
}

Publish locally with ./gradlew :sdk:publishToMavenLocal from sdks/android. The host app needs the Compose compiler plugin when using SupportalChat() or SupportalHelpCenter().

Initialize

kotlin
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Supportal.init(this, SupportalConfig(
            host = "https://support.clientname.app",
            identityTokenProvider = { myBackend.identityToken() },
            primaryColor = Color(0xFF2D6E50),
        ))
        setContent { SupportalChat() }
    }
}

Non-Compose apps

kotlin
Supportal.init(context, SupportalConfig(host = "https://support.clientname.app"))
Supportal.open(context) // launches SupportalActivity

Session & identity

Supportal.identify { token } replaces the provider and exchanges a new session. Supportal.logout() clears the encrypted session token and rotates the anonymous id. The provider must not call back into Supportal during token fetch.

Channel

Sessions are created with channel: "android" alongside identityToken (optional) and a persisted anonymousId UUID.