Unified SDK for Android reference

This reference documents every public class of com.amplitude:unified-android and every option on UnifiedConfigurationBuilder, verified against version 1.1.0. That version bundles Android-Kotlin SDK 1.36.0 (com.amplitude:analytics-android), Session Replay Android plugin 0.31.0, and Experiment Android SDK 1.18.0. Every analytics method behaves as the Android-Kotlin SDK reference describes. For changes between versions, go to the Unified SDK changelog.

kotlin
import com.amplitude.unified.AmplitudeUnified
import com.amplitude.unified.UnifiedConfigurationBuilder

Exports

Every analytics method, such as track(), identify(), setUserId(), reset(), flush(), and add(), comes from the Android-Kotlin SDK. Go to the Android-Kotlin SDK reference.

AmplitudeUnified

kotlin
open class AmplitudeUnified : com.amplitude.android.Amplitude

Constructors

kotlin
AmplitudeUnified(
    apiKey: String,
    applicationContext: Context,
    configure: UnifiedConfigurationBuilder.() -> Unit = {},
)

AmplitudeUnified(configurationBuilder: UnifiedConfigurationBuilder)

The first constructor has @JvmOverloads, so Java can call new AmplitudeUnified(apiKey, context) without the lambda.

The constructor builds Analytics, then installs Session Replay, then Experiment, each as a plugin. If a product throws during setup, the SDK logs Failed to install plugin "<name>": <exception>, skips that product, and keeps the rest running. Analytics finishes loading stored identity in the background. Wait for isBuilt before reading identity that must come from storage:

kotlin
amplitude.isBuilt.await() // inside a coroutine
val deviceId = amplitude.getDeviceId()

analytics

kotlin
val analytics: AmplitudeUnified

Returns the same instance. Use it when you want call sites to read amplitude.analytics.track(...).

sessionReplay

kotlin
val sessionReplay: SessionReplay?

Returns the Session Replay client (com.amplitude.android.sessionreplay.SessionReplay), or null when Session Replay is turned off or failed to install. Call start() to start or resume capture and stop() to pause it. For other members, go to the Session Replay Android plugin.

experiment

kotlin
val experiment: ExperimentClient?

Returns the Experiment client (com.amplitude.experiment.ExperimentClient), or null when Experiment is turned off, failed to install, or the instance holds more than one Experiment plugin. For client methods such as variant(), fetch(), and all(), go to the Experiment Android SDK.

UnifiedConfigurationBuilder

kotlin
open class UnifiedConfigurationBuilder(apiKey: String, applicationContext: Context)

The SDK copies the options when it builds the client. Changing a builder afterward has no effect on that client.

java
UnifiedConfigurationBuilder builder =
    new UnifiedConfigurationBuilder("YOUR_API_KEY", getApplicationContext());
builder.getAnalytics().setFlushQueueSize(20);
builder.getExperiment().setDeploymentKey("YOUR_DEPLOYMENT_KEY");
AmplitudeUnified amplitude = builder.build();

SessionReplayConfigurationBuilder

Session Replay takes the API key, server zone, device ID, and session ID from Analytics. It has no user ID of its own.

ExperimentConfigurationBuilder

Was this helpful?

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

On this page