The AppDNA SDK supports server-driven onboarding flows that are configured remotely and rendered natively using Jetpack Compose. Onboarding flows guide users through welcome screens, questions, and value propositions without requiring app updates.
Present an Onboarding Flow
Present an onboarding flow by passing the current Activity and an optional flow ID:
import ai.appdna.sdk.AppDNA
val presented = AppDNA.presentOnboarding(
activity = this,
flowId = "main_flow",
listener = onboardingListener
)
if (!presented) {
Log.w("Onboarding", "No onboarding flow available")
}
The method returns a Boolean indicating whether the flow was successfully presented. If flowId is null, the SDK uses the active flow from the remote configuration.
// Use the default active flow
val presented = AppDNA.presentOnboarding(
activity = this,
flowId = null,
listener = onboardingListener
)
Onboarding Module
The AppDNA.onboarding module provides direct access to onboarding functionality:
| Method | Return | Description |
|---|
present(activity, flowId?, context?) | Boolean | Presents the onboarding flow |
setDelegate(delegate: AppDNAOnboardingDelegate?) | Unit | Sets the onboarding delegate |
Onboarding Context
Pass additional context when presenting an onboarding flow:
import ai.appdna.sdk.onboarding.OnboardingContext
val context = OnboardingContext(
source = "deep_link",
campaign = "summer_promo",
referrer = "friend_invite",
userProperties = mapOf("tier" to "free"),
experimentOverrides = mapOf("welcome_variant" to "b")
)
AppDNA.onboarding.present(
activity = this,
flowId = "main_flow",
context = context
)
OnboardingContext Properties
| Property | Type | Description |
|---|
source | String? | Where the user came from |
campaign | String? | Marketing campaign identifier |
referrer | String? | Referral source |
userProperties | Map<String, Any>? | Additional user properties for targeting |
experimentOverrides | Map<String, String>? | Override experiment variants for testing |
Onboarding Delegate
Implement AppDNAOnboardingDelegate to receive onboarding lifecycle callbacks:
import ai.appdna.sdk.onboarding.AppDNAOnboardingDelegate
class MyOnboardingDelegate : AppDNAOnboardingDelegate {
override fun onOnboardingStarted(flowId: String) {
Log.d("Onboarding", "Flow started: $flowId")
}
override fun onOnboardingStepChanged(
flowId: String,
stepId: String,
stepIndex: Int,
totalSteps: Int
) {
Log.d("Onboarding", "Step $stepIndex/$totalSteps: $stepId")
}
override fun onOnboardingCompleted(flowId: String, responses: Map<String, Any>) {
Log.d("Onboarding", "Flow completed: $flowId")
Log.d("Onboarding", "Responses: $responses")
// Navigate to main app
}
override fun onOnboardingDismissed(flowId: String, atStep: Int) {
Log.d("Onboarding", "Flow dismissed at step $atStep")
}
}
// Set the delegate
AppDNA.onboarding.setDelegate(MyOnboardingDelegate())
Step Types
Onboarding flows are composed of steps, each with a specific type:
| Step Type | Description |
|---|
WELCOME | Welcome or splash screen |
QUESTION | User input step with single or multi-select options |
VALUE_PROP | Value proposition or feature highlight screen |
CUSTOM | Custom step rendered from server-defined templates |
Selection Modes
Question steps support two selection modes:
| Mode | Description |
|---|
SINGLE | User selects exactly one option |
MULTI | User can select multiple options |
Onboarding flows are rendered using Jetpack Compose. The SDK handles the full UI lifecycle, including step transitions, animations, and response collection. Your app only needs to handle the delegate callbacks.
Auto-Tracked Events
The onboarding module automatically tracks the following events:
| Event | Triggered When |
|---|
onboarding_flow_started | User begins an onboarding flow |
onboarding_step_viewed | A step is displayed to the user |
onboarding_step_completed | User completes a step |
onboarding_step_skipped | User skips a step |
onboarding_flow_completed | User reaches the end of the flow |
onboarding_flow_dismissed | User dismisses the flow before completing |
The responses map passed to onOnboardingCompleted contains all user answers keyed by step ID. Use these responses to personalize the user experience or send them to your backend for analysis.
Next Steps
- Present Paywalls at the end of onboarding flows
- Set up Billing to handle purchases triggered from onboarding
- Learn about Offline Support for onboarding config caching