Skip to main content

GitHub

View source code and contribute

Installation

Gradle (JitPack)

Add the JitPack repository to your settings.gradle.kts:
settings.gradle.kts
Add the dependency to your app’s build.gradle.kts:
build.gradle.kts

Quick Start

What can you build?

The SDK provides two main APIs for different use cases:

Realtime API

Realtime video streams via WebRTC

Queue API

Batch video processing

Platform Requirements

The Android SDK requires:
  • Android API 24+ (Android 7.0 Nougat)
  • Kotlin 2.1+
  • Java 17
  • A real device for camera access (emulator does not support WebRTC camera features)

Client Setup

Initialize the Decart client with your API key and an Android Context:
Parameters:
  • apiKey (required) - Your Decart API key from the platform
  • baseUrl (optional) - Custom WebSocket endpoint for the Realtime API
  • httpBaseUrl (optional) - Custom HTTP endpoint for the Queue API
  • logLevel (optional) - Minimum log level: VERBOSE, DEBUG, INFO, WARN, ERROR, NONE
Store your API key securely. Never commit API keys to version control. Use BuildConfig fields, encrypted shared preferences, or fetch ephemeral keys from your backend.

Client Tokens

For production Android apps using the Realtime API, fetch short-lived client tokens from your backend instead of embedding your permanent API key in the APK:
See Client Tokens for details on secure client-side authentication.

Available Models

Realtime Models

Use these with client.realtime.connect():
Each model exposes properties for optimal camera configuration:

Batch Video Models

Use these with client.queue.submit() or client.queue.submitAndPoll():

Kotlin Coroutines & Flow

The SDK uses Kotlin coroutines and Flow for reactive state management:
All realtime state is exposed as Kotlin StateFlow or SharedFlow. Collect them in a lifecycle-aware scope (e.g., lifecycleScope or viewModelScope) to avoid leaks.

Jetpack Compose Integration

The SDK works with Jetpack Compose through WebRTC’s SurfaceViewRenderer:

Android Permissions

Your app must declare camera and internet permissions. Add these to your AndroidManifest.xml:
Request camera permission at runtime before connecting:

Type Safety

The SDK uses typed input classes for each batch video model category, providing compile-time guarantees:

Error Handling

The SDK provides two error mechanisms — one for realtime, one for queue: Realtime errors are emitted via the errors SharedFlow:
Queue errors throw typed exceptions:

Sample App

The SDK includes a sample Jetpack Compose app with:
  • Realtime tab — Camera capture + WebRTC streaming with live prompt changes
  • Video tab — Batch job submission, status updates, and result playback
For a more complete app showcasing real-world use cases — video restyling, 90+ style presets, multiple view modes, and swipe navigation — see the Decart Android Example App.

Ready to start building?

Realtime API Guide

Build realtime Android experiencesComplete guide with Jetpack Compose examples for camera handling, video transformation, and interactive applications.

Queue API Guide

Batch video processingEdit videos, control motion, and transform videos with typed input classes and Flow-based progress tracking.