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.

Config Methods

MethodSignatureReturnsDescription
getRemoteConfiggetRemoteConfig(key: String)Any?Retrieve a remote configuration value by key.
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.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)
}

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?
)