Initialize
Initialize once, as early as possible. This is the only required call. After it, the SDK tracks installs, refreshes campaign config on every foreground, and keeps a WebView warm so the first screen paints instantly.
- Android
- iOS
Call Flyy.start in your launcher activity's onCreate:
Flyy.start(this) {
partnerId = "YOUR_PARTNER_KEY" // dashboard → Settings
environment = FlyyEnvironment.STAGE // PRODUCTION when live
user = "user-1001" // or userToken = "…" (see Identify users)
themeColor = "#7C3AED"
}
Flyy.start is idempotent. A repeat call (rotation, re-entry) initializes
nothing again, re-sends no identity and adds no duplicate listeners. Config is
saved, so an activity restored after process death works without a new call.
Prefer to initialize in Application.onCreate? Use the explicit API instead:
class App : Application() {
override fun onCreate() {
super.onCreate()
Flyy.init(this, "YOUR_PARTNER_KEY", Flyy.STAGE)
}
}
Options
Only partnerId is required.
| Option | Default | What it does |
|---|---|---|
partnerId | — | Partner key from the dashboard. Required. |
environment | PRODUCTION | FlyyEnvironment.PRODUCTION or STAGE. |
user | — | Your user id. Same as calling setUser. |
userToken | — | Token from your backend. Wins over user. |
themeColor | partner default | Primary brand color, e.g. "#7C3AED". |
uiVariant | partner default | Visual style of the rewards UI. |
segmentId | — | Segment for this user. |
floatingWidgets | false | Show dashboard-configured bubbles on your screens. See Floating widgets. |
matchHostTheme | true | Read your app's colors, fonts and shapes. See Theming. |
hostTheme | — | Manual theme overrides, e.g. mapOf("colors.primary" to "#C2138F"). |
pushToken | — | An FCM token you already have. |
prewarm | true | Keep a hidden WebView ready for an instant first open. |
otaEnabled | true | Download newer rewards UI builds. See OTA. |
sdkUrl | Flyy hosted | Serve the rewards UI from your own origin. |
extras | — | Extra key/values passed to the rewards UI. |
onUiEvent { } | — | Called for every rewards UI activity event. |
onClosed { } | — | Called when the user closes the full-screen SDK. |
Call Flyy.initialize in application(_:didFinishLaunchingWithOptions:), or in
your SwiftUI App initializer:
Flyy.initialize(FlyyConfig(
partnerId: "YOUR_PARTNER_KEY",
environment: .stage, // .production when live
themeColor: "#7C3AED"
))
@main
struct MyApp: App {
init() {
Flyy.initialize(FlyyConfig(partnerId: "YOUR_PARTNER_KEY", environment: .stage))
}
var body: some Scene { WindowGroup { ContentView() } }
}
FlyyConfig options
Only partnerId is required.
| Parameter | Default | What it does |
|---|---|---|
partnerId | — | Partner key from the dashboard. Required. |
environment | .production | .production or .stage. |
themeColor | partner default | Primary brand color. |
uiVariant | partner default | Visual style of the rewards UI. |
segmentId | nil | Segment for this user. |
floatingWidgets | false | Show dashboard-configured bubbles. See Floating widgets. |
matchHostTheme | true | Read your app's colors, fonts and dark mode. See Theming. |
hostTheme | [:] | Manual theme overrides. |
useBundledAssets | false | Serve the rewards UI from a FlyyDist folder in your app. See OTA. |
otaEnabled | true | Download newer rewards UI builds. |
reportScreens | true | Report your screens to the dashboard so targeting uses pickers. |
subscribeConfigTopic | true | Subscribe to the config-refresh push topic when Firebase is linked. |
sdkUrl | Flyy hosted | Serve the rewards UI from your own origin. |
extras | [:] | Extra key/values passed to the rewards UI. |
Call Flyy.prewarm() after initializing to prepare a hidden WebView for an instant first open.
Environments
| Environment | Use it for |
|---|---|
STAGE | Development and QA. Uses your staging campaigns and test wallet. |
PRODUCTION | Release builds. Real rewards and payouts. |
Choose the environment from your build type so a debug build can never pay out real rewards:
environment = if (BuildConfig.DEBUG) FlyyEnvironment.STAGE else FlyyEnvironment.PRODUCTION