Skip to content

Android quickstart

In a few minutes your Android app will read a real feature flag — cached durably, safe offline, with the device identity minted and stored for you.

Requires minSdk 26 (Android 8.0). Kotlin, with coroutines as the only dependency family.

The SDK is pre-release (v0.1.0) and isn’t published to Maven Central or any registry yet. If your team has been given access to the repository, consume it as a source dependency — a Gradle included build of FortressFlag_SDK_android, whose library module is fortressflag.

Once, at app startup — your Application.onCreate is the natural place:

import com.fortressflag.sdk.Configuration
import com.fortressflag.sdk.Environment
import com.fortressflag.sdk.FortressFlag
FortressFlag.start(
context,
Configuration(
sdkKey = "ffc_prod_…", // from your project's SDK keys screen
environment = Environment.PRODUCTION,
),
)

The SDK loads cached values immediately and polls for changes in the background. The key is a client key — it ships in your app by design.

if (FortressFlag.isEnabled("new-checkout", default = false)) {
// show the new checkout
}

stringValue and numberValue read multivariate flags the same way, and every read is served from memory — no I/O, no network, on whatever thread you call from.

That’s it — your flag is live. Toggle it in the dashboard and the app follows on its next poll.

isEnabled, stringValue, and numberValue never throw. Every read falls back through the last values this device actually saw — including from previous runs, via the durable cache — and then to your call-site default. An outage never reaches your users.

Two platform facts, before they reach an invoice

Section titled “Two platform facts, before they reach an invoice”

FortressFlag bills per device, and Android has two facts worth knowing up front:

  • Identity is per app today. If a user runs three of your apps on one phone, that currently counts as up to three devices — Android apps don’t yet share a FortressFlag identity the way an iOS app family can.
  • Uninstalling your app wipes the identity. Android clears the app’s Keystore-backed data on uninstall, so a reinstall mints a fresh identity — and counts as a new device. (This differs from iOS, where the keychain persists.)

The identity itself is random-minted and pseudonymous — never derived from ANDROID_ID or any hardware identifier. And emulators mint a sim_ identity: served flags normally, never billed.