Skip to main content
This page provides a comprehensive reference for all public methods, properties, and types in the AppDNA Android SDK.

Core Methods

Methods available directly on the AppDNA object.
MethodSignatureDescription
configureconfigure(context: Context, apiKey: String, environment: Environment, options: AppDNAOptions)Initialize the SDK. Call once in Application.onCreate().
identifyidentify(userId: String, traits: Map<String, Any>?)Associate events with a user ID and optional traits.
resetreset()Clear user identity, generate new anonymous ID, and flush events.
tracktrack(event: String, properties: Map<String, Any>?)Track a named event with optional properties.
flushflush()Force an immediate flush of all queued events.
onReadyonReady(callback: () -> Unit)Register a callback for when the SDK is fully initialized.
shutdownshutdown()Gracefully shut down the SDK and release resources.
setLogLevelsetLogLevel(level: String)Change log verbosity at runtime. Accepts "none", "error", "warning", "info", "debug".
setConsentsetConsent(analytics: Boolean)Enable or disable analytics data collection.

Session Data Methods

MethodSignatureDescription
setSessionDatasetSessionData(key: String, value: Any)Store a key-value pair in the session data store.
getSessionDatagetSessionData(key: String): Any?Retrieve a session data value by key.
clearSessionDataclearSessionData()Clear all app-defined session data.

Config Methods

MethodSignatureReturnsDescription
getRemoteConfiggetRemoteConfig(key: String)Any?Retrieve a remote configuration value by key.
forceRefreshConfigforceRefreshConfig()UnitForce an immediate refresh of remote configuration.
isFeatureEnabledisFeatureEnabled(flag: String)BooleanCheck whether a feature flag is enabled.

Experiment Methods

MethodSignatureReturnsDescription
getExperimentVariantgetExperimentVariant(experimentId: String)String?Get the assigned variant for an experiment.
isInVariantisInVariant(experimentId: String, variantId: String)BooleanCheck if the user is in a specific experiment variant.
getExperimentConfiggetExperimentConfig(experimentId: String, key: String)Any?Get a configuration value for a specific experiment.

Push Methods

MethodSignatureDescription
setPushTokensetPushToken(token: String)Register the FCM push token.
onNewPushTokenonNewPushToken(token: String)Alternative method to register the FCM push token.
setPushPermissionsetPushPermission(granted: Boolean)Report push notification permission status.
trackPushDeliveredtrackPushDelivered(pushId: String)Track that a push notification was delivered.
trackPushTappedtrackPushTapped(pushId: String, action: String?)Track that a push notification was tapped.

Presentation Methods

MethodSignatureReturnsDescription
presentOnboardingpresentOnboarding(activity: Activity, flowId: String?, listener: AppDNAOnboardingDelegate?)BooleanPresent an onboarding flow. Returns whether it was presented.
presentPaywallpresentPaywall(activity: Activity, id: String, context: PaywallContext?, listener: AppDNAPaywallDelegate?)UnitPresent a paywall.

Web Entitlements

MemberTypeDescription
webEntitlementWebEntitlement? (property)The current web entitlement, if any.
onWebEntitlementChanged(callback: (WebEntitlement?) -> Unit)Register a listener for web entitlement changes.
MethodSignatureDescription
checkDeferredDeepLinkcheckDeferredDeepLink(callback: (DeferredDeepLink?) -> Unit)Check for a deferred deep link and invoke the callback with the result.

Module Namespaces

The SDK exposes the following module namespaces for direct access:
NamespaceTypeDescription
AppDNA.pushPushModulePush notification management
AppDNA.billingBillingModuleBilling and subscription management
AppDNA.onboardingOnboardingModuleOnboarding flow presentation
AppDNA.paywallPaywallModulePaywall presentation
AppDNA.remoteConfigRemoteConfigModuleRemote configuration access
AppDNA.featuresFeaturesModuleFeature flag access
AppDNA.experimentsExperimentsModuleExperiment variant access
AppDNA.inAppMessagesInAppMessagesModuleIn-app message management
AppDNA.surveysSurveysModuleSurvey management
AppDNA.screensScreensModuleServer-driven screen and flow presentation
AppDNA.deepLinksDeepLinksModuleDeep link handling

Delegate Interfaces

AppDNAPushDelegate

interface AppDNAPushDelegate {
    fun onPushTokenRegistered(token: String)
    fun onPushReceived(notification: PushPayload, inForeground: Boolean)
    fun onPushTapped(notification: PushPayload, actionId: String?)
}

AppDNABillingDelegate

interface AppDNABillingDelegate {
    fun onPurchaseCompleted(productId: String, transaction: TransactionInfo)
    fun onPurchaseFailed(productId: String, error: Exception)
    fun onEntitlementsChanged(entitlements: List<Entitlement>)
    fun onRestoreCompleted(restoredProducts: List<String>)
}

AppDNAOnboardingDelegate

interface AppDNAOnboardingDelegate {
    fun onOnboardingStarted(flowId: String)
    fun onOnboardingStepChanged(flowId: String, stepId: String, stepIndex: Int, totalSteps: Int)
    fun onOnboardingCompleted(flowId: String, responses: Map<String, Any>)
    fun onOnboardingDismissed(flowId: String, atStep: Int)

    // Async hooks (optional)
    suspend fun onBeforeStepAdvance(flowId: String, fromStepId: String, stepIndex: Int, stepType: String, responses: Map<String, Any>, stepData: Map<String, Any>?): StepAdvanceResult
    suspend fun onBeforeStepRender(flowId: String, stepId: String, stepIndex: Int, stepType: String, responses: Map<String, Any>): StepConfigOverride?
}

AppDNAPaywallDelegate

interface AppDNAPaywallDelegate {
    fun onPaywallPresented(paywallId: String)
    fun onPaywallAction(paywallId: String, action: PaywallAction)
    fun onPaywallPurchaseStarted(paywallId: String, productId: String)
    fun onPaywallPurchaseCompleted(paywallId: String, productId: String, transaction: TransactionInfo)
    fun onPaywallPurchaseFailed(paywallId: String, error: Exception)
    fun onPaywallDismissed(paywallId: String)
}

Types

AppDNAOptions

data class AppDNAOptions(
    val flushInterval: Long = 30L,
    val batchSize: Int = 20,
    val configTTL: Long = 300L,
    val logLevel: LogLevel = LogLevel.WARNING
)

Environment

enum class Environment(val baseUrl: String) {
    PRODUCTION("https://api.appdna.ai"),
    SANDBOX("https://sandbox-api.appdna.ai")
}

LogLevel

enum class LogLevel(val value: Int) {
    NONE(0),
    ERROR(1),
    WARNING(2),
    INFO(3),
    DEBUG(4)
}

PaywallContext

data class PaywallContext(
    val placement: String,
    val experiment: String? = null,
    val variant: String? = null
)

OnboardingContext

data class OnboardingContext(
    val source: String? = null,
    val campaign: String? = null,
    val referrer: String? = null,
    val userProperties: Map<String, Any>? = null,
    val experimentOverrides: Map<String, String>? = null
)

PushPayload

data class PushPayload(
    val pushId: String,
    val title: String,
    val body: String,
    val imageUrl: String? = null,
    val data: Map<String, Any>? = null,
    val action: PushAction? = null
)

PushAction

data class PushAction(
    val type: String,
    val value: String
)

TransactionInfo

data class TransactionInfo(
    val transactionId: String,
    val productId: String,
    val purchaseDate: String,
    val environment: String
)

Entitlement

data class Entitlement(
    val productId: String,
    val store: String,
    val status: String,
    val expiresAt: String? = null,
    val isTrial: Boolean,
    val offerType: String? = null
)

ProductInfo

data class ProductInfo(
    val id: String,
    val name: String,
    val description: String,
    val formattedPrice: String,
    val priceMicros: Long,
    val currencyCode: String,
    val offerToken: String? = null
)

PurchaseResult

sealed class PurchaseResult {
    data class Purchased(val entitlement: Entitlement) : PurchaseResult()
    object Cancelled : PurchaseResult()
    object Pending : PurchaseResult()
    object Unknown : PurchaseResult()
    data class Failed(val error: Exception) : PurchaseResult()
}

PaywallAction

enum class PaywallAction {
    CTA_TAPPED,
    FEATURE_SELECTED,
    PLAN_CHANGED,
    LINK_TAPPED,
    CUSTOM
}

DismissReason

enum class DismissReason {
    PURCHASED,
    DISMISSED,
    TAPPED_OUTSIDE,
    PROGRAMMATIC
}

WebEntitlement

data class WebEntitlement(
    val productId: String,
    val status: String,
    val expiresAt: String?,
    val source: String
)
data class DeferredDeepLink(
    val url: String,
    val campaign: String?,
    val medium: String?,
    val source: String?
)

StepAdvanceResult

sealed class StepAdvanceResult {
    object Proceed : StepAdvanceResult()
    data class ProceedWithData(val data: Map<String, Any>) : StepAdvanceResult()
    data class Block(val message: String) : StepAdvanceResult()
    data class SkipTo(val stepId: String, val data: Map<String, Any>? = null) : StepAdvanceResult()
}

StepConfigOverride

data class StepConfigOverride(
    val fieldDefaults: Map<String, Any>? = null,
    val title: String? = null,
    val subtitle: String? = null,
    val ctaText: String? = null,
    val layoutOverrides: Map<String, Any>? = null
)

FormFieldType

enum class FormFieldType {
    TEXT, TEXTAREA, NUMBER, EMAIL, PHONE,
    DATE, TIME, DATETIME,
    SELECT, SLIDER, TOGGLE, STEPPER, SEGMENTED
}

Server-Driven Screens

MethodSignatureDescription
showScreenshowScreen(screenId: String, completion: ((ScreenResult) -> Unit)?)Present a server-driven screen by ID.
showFlowshowFlow(flowId: String, completion: ((FlowResult) -> Unit)?)Present a multi-screen flow by ID.
dismissScreendismissScreen()Dismiss the currently presented screen or flow.
enableNavigationInterceptionenableNavigationInterception(forScreens: List<String>?)Enable automatic screen injection between navigations. Pass null for all screens.
disableNavigationInterceptiondisableNavigationInterception()Disable navigation interception.
previewScreenpreviewScreen(json: String)Debug only. Preview a screen from raw JSON config.
screenDelegatevar screenDelegate: AppDNAScreenDelegate?Set a delegate for screen lifecycle callbacks.
isConsentGrantedisConsentGranted(): BooleanCheck if analytics consent has been granted.
getUserTraitsgetUserTraits(): Map<String, Any>?Get the current user traits set via identify().

AppDNAScreenDelegate

interface AppDNAScreenDelegate {
    fun onScreenPresented(screenId: String)
    fun onScreenDismissed(screenId: String, result: ScreenResult)
    fun onFlowCompleted(flowId: String, result: FlowResult)
    fun onScreenAction(screenId: String, action: SectionAction): Boolean
}

ScreenResult

data class ScreenResult(
    val dismissed: Boolean,
    val responses: Map<String, Any>
)

FlowResult

data class FlowResult(
    val completed: Boolean,
    val screensViewed: Int,
    val responses: Map<String, Any>
)

SectionAction

data class SectionAction(
    val sectionId: String,
    val actionType: String,
    val data: Map<String, Any>? = null
)