Skip to main content

Android SDK (Kotlin)

The Orbit Android SDK embeds Orbit’s end-user-facing surfaces into a native Android app: in-app chat (the same omnichannel conversation/inbox the web widget and iOS SDK use), owned in-app messages and content cards, and video rooms. It ships as a single Gradle module with three clients — OrbitChatClient, OrbitInAppClient, and OrbitVideoRoomClient — and targets Android API 21+ (Kotlin, coroutines, kotlinx.serialization, OkHttp). This is a client SDK: it authenticates only with a publishable key (dv_live_pk_…), because it ships inside a distributed app binary. It intentionally does not wrap the server-side management resources (messaging, voice, contacts, campaigns, verify) — those require a secret key and belong in your backend, via the Node SDK or the REST API. See Client / mobile SDKs (different scope, by design) on the SDK index.
Pre-publish — source-only. The Android SDK is not yet on Maven Central — the Gradle dependency line below fails today. Until first publish, vendor the source from the monorepo (packages/sdk-android/) and include it as a Gradle project dependency.

Installation (Gradle)

Headless chat client (OrbitChatClient)

The client ships zero UI — it owns the conversation lifecycle, history, optimistic send, and the real-time inbound stream; your Activity, Fragment, or Compose screen renders it. All network methods are suspend functions.
Each on… method returns an OrbitSubscription; call .cancel() on it to stop receiving the event. Call chat.disconnect() to stop the real-time stream, and chat.close() when the client is done (it cancels the internal coroutine scope — the client cannot be reused after that). Send a file attachment (10 MB client-side guard):

In-app messages and content cards (OrbitInAppClient)

Owned in-app surfaces — assembled server-side into a per-visitor feed, rendered locally, with impression / click / dismiss reported back. Dismissals persist across launches through the storage adapter.

Video rooms (OrbitVideoRoomClient)

Headless and engine-injected: your backend mints the room token server-side (POST /api/v1/video/rooms/:id/join) and hands the token plus server URL to the app. Wire the client over a VideoRoomEngine backed by a WebRTC engine (for example the Orbit Media SDK for Android), so this package carries no hard WebRTC dependency.

Error handling

API failures surface as a typed OrbitApiError carrying the HTTP status and the server response excerpt; a parsed Retry-After lets a 429 be throttled instead of retried in a hot loop. Construction misuse (empty key or a server-side secret key) throws IllegalArgumentException; attachment-size checks throw OrbitChatException.
Only the publishable key (dv_live_pk_… / dv_test_pk_…) may be embedded in the app. The clients refuse a server-side secret key (dv_live_sk_… / dv_test_sk_…) at construction, because anything bundled in a distributed binary is extractable by any user. Real-time updates use header-authenticated polling, so the key never lands in a URL log.