Skip to main content

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.
Distinguishing the Two Entry Points

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

AreaAndroid Entry PointKMP Entry Point
Packagecom.sap.ec.androidcom.sap.ec
Setup ConfigurationAndroidEngagementCloudSDKConfig(applicationCode, launchActivityClass)SdkConfig(applicationCode)
Deep Link Tracking.deepLink.track(activity, intent).deepLink.track(url)
Notification SettingsReturns AndroidNotificationSettings with channel-level detailReturns 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.

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

ScenarioRecommended Entry PointImport
Android app without shared Kotlin codeEngagementCloud (Android)import com.sap.ec.android.EngagementCloud
KMP project with shared code across platformsEngagementCloud (KMP)import com.sap.ec.EngagementCloud
Android app that may adopt KMP laterEither works, but the KMP entry point is future-proofSee 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.android for Android and com.sap.ec for KMP. Always verify your import statement matches the entry point you want to use.
  • The KMP EngagementCloud result types contain only fields available on every platform. The Android-specific EngagementCloud result 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.