Skip to content
Ahmed Abbas edited this page May 27, 2026 · 2 revisions

Convert Android SDK

The Convert Android SDK brings A/B testing, feature flags, and personalization to native Android applications. It resolves experiment and feature decisions on-device from a cached bucketing config, then batches, persists, and flushes tracking events in the background so nothing is lost when the network is unavailable.

Source Repository: android-sdk

flowchart TD
    A0["ConvertSDK / Builder"]
    A1["ConvertContext"]
    A2["DataManager"]
    A3["RuleManager"]
    A4["BucketingManager"]
    A5["ApiManager"]
    A6["FeatureManager"]
    A7["EventManager"]
    A8["Android adapters"]
    A9["WorkManager / EventFlushWorker"]
    A0 -- "Creates" --> A1
    A0 -- "Fetches config via" --> A5
    A0 -- "Wires" --> A8
    A0 -- "Fires events via" --> A7
    A1 -- "Runs experiences via" --> A4
    A1 -- "Runs features via" --> A6
    A1 -- "Accesses data via" --> A2
    A1 -- "Gates with" --> A3
    A1 -- "Enqueues tracking via" --> A5
    A5 -- "Persists offline via" --> A8
    A5 -- "Schedules retry via" --> A9
    A6 -- "Buckets via" --> A4
    A2 -- "Fires events via" --> A7
Loading

Key Differences from the JavaScript SDK

The Android SDK shares the same architecture and bucketing algorithm as the JavaScript SDK, so variation assignment is deterministic and identical across SDKs. It is adapted for the Android runtime:

  • Builder, not constructorConvertSDK.builder(context).sdkKey("...").build() replaces new ConvertSDK(config). The primary constructor is internal.
  • Coroutine-based async — Config fetch and event flush run on a long-lived SDK coroutine scope. onReady { ... } gates your first decision call instead of a Promise.
  • Android adapters — OkHttp for HTTP, SharedPreferences for visitor/sticky state, an internal file for config cache, and SQLite for the offline event queue.
  • Offline-safe by design — Events queue durably to disk and flush via WorkManager with exponential backoff; a NetworkObserver triggers an immediate flush when connectivity returns.
  • Privacy-aware — The default visitor id is an app-scoped UUID v4 (no device identifiers, no PII), lost only on app uninstall.
  • Typed Kotlin models — Decisions return Kotlin data classes (Variation, Feature) and enums (FeatureStatus, GoalDataKey, LogLevel); feature variables use kotlinx.serialization JsonElement with scalar accessor extensions.
  • Java interop@JvmOverloads, @JvmStatic, and SAM-convertible fun interface callbacks make the SDK usable from Java without Kotlin glue.

Getting Started

Android SDK

Core Concepts

How-To Guides

Contributing

Clone this wiki locally