Android and Kotlin Multiplatform Differences
The SAP Engagement Cloud SDK provides two entry points for Android. Both are called EngagementCloud, but they reside in different packages:
com.sap.ec.android.EngagementCloud- The Android-specific entry point, optimized for Android-only projects.com.sap.ec.EngagementCloud- The Kotlin Multiplatform (KMP) entry point, optimized for projects sharing code across platforms.
Since both classes share the same name (EngagementCloud), the import statement determines which entry point your code uses. Always check your imports when switching between Android and KMP examples.
Compatibility
Both entry points are API-compatible, and operations work identically regardless of which one you use. The entry points also share the same module namespaces.
Key Differences
| Area | Android Entry Point | KMP Entry Point |
|---|---|---|
| Package | com.sap.ec.android | com.sap.ec |
| Setup Configuration | AndroidEngagementCloudSDKConfig(applicationCode, launchActivityClass) | SdkConfig(applicationCode) |
| Deep Link Tracking | .deepLink.track(activity, intent) | .deepLink.track(url) |
| Notification Settings | Returns AndroidNotificationSettings with channel-level detail | Returns NotificationSettings with cross-platform fields only |
Setup Configuration
AndroidEngagementCloudSDKConfig accepts Android-specific parameters such as launchActivityClass, which determines the activity that is launched when a push notification is clicked. The KMP SdkConfig is platform-agnostic and therefore doesn't include Android-specific launch behavior.
Event Tracking
Both entry points use the .event namespace for event tracking (e.g., .event.track(event)). They accept the same event types (CustomEvent, etc.) and behave identically.
Deep Link Tracking
The Android entry point accepts an Activity and Intent directly, extracting the deep link URL internally. The KMP entry point expects the URL string, since Activity and Intent are Android-specific types that aren't available on other KMP targets.
Notification Settings
AndroidNotificationSettings includes Android-specific fields such as notification channel details. The KMP NotificationSettings contains only the fields that are available on every platform target.
When to Use Which Entry Point
| Scenario | Recommended Entry Point | Import |
|---|---|---|
| Android app without shared Kotlin code | EngagementCloud (Android) | import com.sap.ec.android.EngagementCloud |
| KMP project with shared code across platforms | EngagementCloud (KMP) | import com.sap.ec.EngagementCloud |
| Android app that may adopt KMP later | Either works, but the KMP entry point is future-proof | See above |
Important Notes
- Package imports matter. Both entry points are called
EngagementCloud. The only way to distinguish them in the code is by their package name:com.sap.ec.androidfor Android andcom.sap.ecfor KMP. Always verify your import statement matches the entry point you want to use. - The KMP
EngagementCloudresult types contain only fields available on every platform. The Android-specificEngagementCloudresult types can contain Android-specific fields, such as notification channel settings. - You can use either entry point on Android. They're interchangeable for most operations. Their main differences are in setup configuration, deep link tracking signatures, and platform-specific return types.
- Throughout the documentation, code examples are shown separately for both entry points in the Android and Kotlin Multiplatform tabs.