1. Configure the SDK
Initialize AppDNA as early as possible in your app lifecycle. Place the configuration call in yourApplication.onCreate() method:
Firebase is automatically initialized from
google-services-appdna.json on Android. You do not need to call any Firebase initialization method manually. Ensure that google-services-appdna.json is in your app/ directory and the Google Services plugin is applied (see Installation).If your app already uses Firebase for your own services (Analytics, Crashlytics, Realtime Database), AppDNA automatically creates a separate named Firebase instance. Your existing Firebase setup is not affected.
Configuration Options
TheAppDNAOptions data class lets you customize SDK behavior:
| Parameter | Type | Default | Description |
|---|---|---|---|
flushInterval | Long | 30L (seconds) | Seconds between automatic event flushes |
batchSize | Int | 20 | Number of events to batch before flushing |
configTTL | Long | 300L (seconds) | Seconds before cached config is considered stale |
logLevel | LogLevel | LogLevel.WARNING | Verbosity of SDK console logs |
Environment
TheEnvironment enum controls which backend the SDK targets:
| Value | Endpoint | Description |
|---|---|---|
Environment.PRODUCTION | https://api.appdna.ai | Production API and configuration |
Environment.SANDBOX | https://sandbox-api.appdna.ai | Sandbox API for testing |
Log Level
TheLogLevel enum controls Logcat log verbosity:
| Value | Raw Value | Description |
|---|---|---|
LogLevel.NONE | 0 | No logging |
LogLevel.ERROR | 1 | Errors only |
LogLevel.WARNING | 2 | Errors and warnings |
LogLevel.INFO | 3 | Errors, warnings, and info |
LogLevel.DEBUG | 4 | All messages including debug |
Use
LogLevel.DEBUG during development to see all SDK activity in Logcat. Switch to LogLevel.WARNING or LogLevel.NONE for production builds.2. Wait for Ready State
The SDK fetches remote configuration asynchronously. UseonReady to know when the SDK is fully initialized:
3. Identify Users
Once a user signs in, callidentify to associate events with their user ID:
Traits are merged with any previously set traits. You do not need to pass all traits on every call — only the ones that have changed.
4. Track Events
Track user actions withtrack:
flushInterval and batchSize settings.
5. Flush Events Manually
Force an immediate flush of all queued events:6. Set User Consent
Control whether the SDK collects and sends analytics data:7. Change Log Level at Runtime
You can adjust the log level after configuration without restarting the app:"none", "error", "warning", "info", "debug".
8. Remote Config and Feature Flags
Retrieve server-side configuration values:9. Experiments
Get the variant assigned to a user for an experiment:10. Session Data
Store cross-module session data that can be used in template interpolation across onboarding flows, paywalls, and in-app messages:{{session.selected_plan}}.
11. Reset on Logout
When a user signs out, callreset to clear the user identity and flush any remaining events:
You now have the SDK configured, user identification, event tracking, remote config, experiments, and session data working. Continue to the module-specific guides for Push Notifications, Billing, Onboarding, and Paywalls.

