Choose Your Platform
iOS
Native Swift SDK distributed via Swift Package Manager and CocoaPods. Requires iOS 15.0+ and Swift 5.9+.
Android
Kotlin SDK distributed via Maven Central (Gradle). Requires Android API 24+ and Kotlin 1.9+.
Flutter
Dart package distributed via pub.dev. Requires Flutter 3.10+ and Dart 3.0+.
React Native
TypeScript package distributed via npm. Requires React Native 0.72+.
Platform Comparison
Requirements
| iOS | Android | Flutter | React Native | |
|---|---|---|---|---|
| Package | AppDNASDK | ai.appdna.sdk | appdna_sdk | @appdna/react-native-sdk |
| Language | Swift 5.9+ | Kotlin 1.9+ | Dart 3.0+ | TypeScript |
| Min Platform | iOS 15.0 | Android API 24 | Flutter 3.10+ | React Native 0.72+ |
| Distribution | SPM, CocoaPods | Maven Central (Gradle) | pub.dev | npm |
| Current Version | 1.0.0 | 1.0.0 | 1.0.0 | 1.0.0 |
Dependencies
| iOS | Android | Flutter | React Native | |
|---|---|---|---|---|
| HTTP | URLSession (built-in) | OkHttp3 | Platform channels | NativeModules bridge |
| Billing | StoreKit 2 (built-in) | Google Play Billing 7.0 | Platform channels to native | NativeModules bridge |
| Config Sync | FirebaseFirestore | Firebase Firestore 24.10 | Platform channels to native | NativeEventEmitter |
| Secure Storage | KeychainAccess | EncryptedSharedPreferences | Platform-specific | Platform-specific |
Flutter and React Native SDKs bridge to the native iOS and Android implementations under the hood. You do not need to add native dependencies manually — they are bundled with the SDK.
Core API
Every SDK exposes the same five core methods. The API is intentionally minimal — initialize once, identify your user, track events, and the SDK handles the rest.configure
Initialize the SDK with your API key. Call this exactly once at app startup.
- iOS
- Android
- Flutter
- React Native
identify
Link a user identity with optional traits. Traits are merged with previously set values.
- iOS
- Android
- Flutter
- React Native
track
Record a custom event with optional properties. Events are queued locally and flushed automatically.
- iOS
- Android
- Flutter
- React Native
reset
Clear the user identity on sign-out. The anonymous ID is preserved so device-level analytics continue uninterrupted.
- iOS
- Android
- Flutter
- React Native
flush
Force-send all queued events immediately. Useful before the app enters the background.
- iOS
- Android
- Flutter
- React Native
Module Namespaces
Beyond the core API, the SDK organizes features into 10 module namespaces. Each namespace is accessed as a property on theAppDNA singleton and operates independently while sharing the core event pipeline, identity state, and configuration layer.
| Namespace | Purpose | Example |
|---|---|---|
push | Push notification registration and handling | AppDNA.push.requestPermission() |
billing | Subscription status, product fetching, purchases | AppDNA.billing.getProducts() |
onboarding | Server-driven onboarding flow presentation | AppDNA.onboarding.present() |
paywall | Server-driven paywall rendering and events | AppDNA.paywall.present("premium") |
remoteConfig | Key-value remote configuration | AppDNA.remoteConfig.getString("key") |
features | Feature flags and entitlements | AppDNA.features.isEnabled("dark_mode") |
experiments | A/B experiment assignment and exposure tracking | AppDNA.experiments.getVariant("test") |
surveys | In-app survey presentation and response collection | AppDNA.surveys.present("nps") |
inAppMessages | Triggered in-app messaging | AppDNA.inAppMessages.check() |
deepLinks | Deep link routing and deferred deep links | AppDNA.deepLinks.checkDeferred() |
Delegate and Callback Protocols
Each module that communicates events back to your application uses a delegate or callback pattern. There are 7 delegate protocols shared across all platforms:| Protocol | Key Methods | Used By |
|---|---|---|
OnboardingDelegate | Flow started, step completed, flow completed, flow skipped | onboarding |
PaywallDelegate | Presented, dismissed, purchase started, purchase completed | paywall |
SurveyDelegate | Presented, response submitted, dismissed | surveys |
InAppMessageDelegate | Presented, action taken, dismissed | inAppMessages |
DeepLinkDelegate | Link received, deferred link resolved | deepLinks |
ExperimentDelegate | Exposure tracked, variant assigned | experiments |
PushNotificationDelegate | Token received, notification presented, notification opened | push |
- iOS
- Android
- Flutter
- React Native
Implement Swift protocols with default empty methods. Conform to only what you need:
Architecture
Offline-First Design
All four SDKs share the same offline-first architecture. Your app never crashes or degrades because of a network issue. Configuration priority — the SDK resolves config using a three-tier fallback:| Setting | Default | Description |
|---|---|---|
| Flush interval | 30 seconds | Time between automatic flushes |
| Batch size | 20 events | Events are flushed when the batch reaches this size |
| Config TTL | 5 minutes | Time before cached config is considered stale |
Experiment Bucketing
All SDKs use the same MurmurHash3 algorithm for deterministic experiment assignment:Config Bundle for CI/CD
Generate a versioned JSON config bundle on the server and embed it in your app binary for zero-latency first launch:- iOS
- Android
- Flutter
- React Native
Add
appdna-config.json to your Xcode project as a bundle resource.Feature Parity Matrix
All features are available on all platforms. This matrix confirms full parity across SDKs.| Feature | iOS | Android | Flutter | React Native |
|---|---|---|---|---|
| Event tracking | Yes | Yes | Yes | Yes |
| User identification | Yes | Yes | Yes | Yes |
| Offline event queue | Yes | Yes | Yes | Yes |
| Remote config | Yes | Yes | Yes | Yes |
| Feature flags | Yes | Yes | Yes | Yes |
| A/B experiments | Yes | Yes | Yes | Yes |
| Push notifications | Yes | Yes | Yes | Yes |
| Billing / subscriptions | Yes | Yes | Yes | Yes |
| Server-driven onboarding | Yes | Yes | Yes | Yes |
| Server-driven paywalls | Yes | Yes | Yes | Yes |
| In-app messages | Yes | Yes | Yes | Yes |
| Surveys | Yes | Yes | Yes | Yes |
| Deep links | Yes | Yes | Yes | Yes |
| Config bundle embedding | Yes | Yes | Yes | Yes |
| Consent management | Yes | Yes | Yes | Yes |
| Deterministic experiments | Yes | Yes | Yes | Yes |
Configuration Options
All SDKs accept the same configuration options at initialization:| Option | Type | Default | Description |
|---|---|---|---|
flushInterval | number | 30 | Seconds between automatic event flushes |
batchSize | number | 20 | Events to batch before flushing |
configTTL | number | 300 | Seconds before cached config is stale |
logLevel | enum | warning | Console log verbosity: none, error, warning, info, debug |
billingProvider | enum | platform default | Billing integration: storeKit2 (iOS), playBilling (Android), revenueCat, none |
Use
logLevel: debug during development and logLevel: warning or logLevel: none for production builds.Environments
| Environment | API Base URL | Key Prefix |
|---|---|---|
| Production | https://api.appdna.ai | adn_live_ |
| Sandbox | https://sandbox-api.appdna.ai | adn_test_ |
Next Steps
iOS Installation
Add AppDNA to your Xcode project via SPM or CocoaPods.
Android Installation
Add AppDNA to your Gradle build.
Flutter Installation
Add the appdna_sdk package from pub.dev.
React Native Installation
Install @appdna/react-native-sdk from npm.