Skip to main content

Initial Configuration

Create a platform-specific configuration object and pass it to enable().

The SDK provides two entry points depending on your project type:

  • com.sap.ec.android.EngagementCloud — for Android apps only
  • com.sap.ec.EngagementCloud — for Kotlin Multiplatform (KMP) projects that share code across platforms
ScenarioRecommended Entry Point
Android app onlycom.sap.ec.android.EngagementCloud
KMP project sharing code across platformscom.sap.ec.EngagementCloud
info

For a detailed comparison, see Android and Kotlin Multiplatform Differences.

val config = AndroidEngagementCloudSDKConfig(
applicationCode,
launchActivityClass
)
  • applicationCode is a string value of the application code in SAP Engagement Cloud.
  • launchActivityClass is an optional Activity class that handles app launch events, such as push message opens.

Validating the Configuration

During the enable() call, the SDK validates:

  • All platforms: Application code is provided (non-empty) and its format is correct.
  • Web: Service worker path exists and scope is valid.
  • Android: Launch activity class exists and is accessible (reflective accessibility).

Any validation errors are returned in the Result or the thrown error for Swift and JavaScript. The SDK logs the error and aborts the enable call gracefully, without affecting app stability.

Optional and Required Fields

FieldPlatformRequiredNotes
applicationCodeAllRequiredWithout it, tracking does not work because the backend rejects requests.
launchActivityClassAndroidOptionalIs required for deep-link launches with push.
serviceWorkerOptionsWebOptionalOnly required for Web Push. When not using Web push, it's omitted.
applicationServerKeyWebRequired (for push)VAPID key must match your settings in SAP Engagement Cloud.

Dynamic Configuration Changes

To switch environments (for example, staging to production) or change application codes:

  1. Call disable().
  2. Call changeApplicationCode(newCode) if the app code changed.
  3. Call enable() with the new configuration.
  4. Re-link contact if needed.

Security Recommendations

  • Never hard-code secrets in your configuration.
  • Validate that the application code source is authentic.