Core Methods
Methods available directly on theAppDNA object.
| Method | Signature | Description |
|---|---|---|
configure | configure(context: Context, apiKey: String, environment: Environment, options: AppDNAOptions) | Initialize the SDK. Call once in Application.onCreate(). |
identify | identify(userId: String, traits: Map<String, Any>?) | Associate events with a user ID and optional traits. |
reset | reset() | Clear user identity, generate new anonymous ID, and flush events. |
track | track(event: String, properties: Map<String, Any>?) | Track a named event with optional properties. |
flush | flush() | Force an immediate flush of all queued events. |
onReady | onReady(callback: () -> Unit) | Register a callback for when the SDK is fully initialized. |
shutdown | shutdown() | Gracefully shut down the SDK and release resources. |
setLogLevel | setLogLevel(level: String) | Change log verbosity at runtime. Accepts "none", "error", "warning", "info", "debug". |
setConsent | setConsent(analytics: Boolean) | Enable or disable analytics data collection. |
Config Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
getRemoteConfig | getRemoteConfig(key: String) | Any? | Retrieve a remote configuration value by key. |
isFeatureEnabled | isFeatureEnabled(flag: String) | Boolean | Check whether a feature flag is enabled. |
Experiment Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
getExperimentVariant | getExperimentVariant(experimentId: String) | String? | Get the assigned variant for an experiment. |
isInVariant | isInVariant(experimentId: String, variantId: String) | Boolean | Check if the user is in a specific experiment variant. |
getExperimentConfig | getExperimentConfig(experimentId: String, key: String) | Any? | Get a configuration value for a specific experiment. |
Push Methods
| Method | Signature | Description |
|---|---|---|
setPushToken | setPushToken(token: String) | Register the FCM push token. |
onNewPushToken | onNewPushToken(token: String) | Alternative method to register the FCM push token. |
setPushPermission | setPushPermission(granted: Boolean) | Report push notification permission status. |
trackPushDelivered | trackPushDelivered(pushId: String) | Track that a push notification was delivered. |
trackPushTapped | trackPushTapped(pushId: String, action: String?) | Track that a push notification was tapped. |
Presentation Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
presentOnboarding | presentOnboarding(activity: Activity, flowId: String?, listener: AppDNAOnboardingDelegate?) | Boolean | Present an onboarding flow. Returns whether it was presented. |
presentPaywall | presentPaywall(activity: Activity, id: String, context: PaywallContext?, listener: AppDNAPaywallDelegate?) | Unit | Present a paywall. |
Web Entitlements
| Member | Type | Description |
|---|---|---|
webEntitlement | WebEntitlement? (property) | The current web entitlement, if any. |
onWebEntitlementChanged | (callback: (WebEntitlement?) -> Unit) | Register a listener for web entitlement changes. |
Deep Links
| Method | Signature | Description |
|---|---|---|
checkDeferredDeepLink | checkDeferredDeepLink(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:| Namespace | Type | Description |
|---|---|---|
AppDNA.push | PushModule | Push notification management |
AppDNA.billing | BillingModule | Billing and subscription management |
AppDNA.onboarding | OnboardingModule | Onboarding flow presentation |
AppDNA.paywall | PaywallModule | Paywall presentation |
AppDNA.remoteConfig | RemoteConfigModule | Remote configuration access |
AppDNA.features | FeaturesModule | Feature flag access |
AppDNA.experiments | ExperimentsModule | Experiment variant access |
AppDNA.inAppMessages | InAppMessagesModule | In-app message management |
AppDNA.surveys | SurveysModule | Survey management |
AppDNA.deepLinks | DeepLinksModule | Deep link handling |