Initialization (Version 3.x)

Configure the Data 360 Module for the Engagement Mobile SDK before using it to invoke web services using the API. Use the CdpConfigBuilder helper class for iOS or CdpConfig.Builder helper class for Android to build your SDK configuration by providing required settings appId and endpoint that can be obtained from your Mobile Connector. Optionally, configure the trackScreens, trackLifecycle, and sessionTimeoutInSeconds settings.

The appId configuration field and appSourceId in the API/network layer refer to the same value — the UUID from the Data 360 mobile app connector.

SettingField TypeDescription
appIdstringRequired. The appId setting uniquely identifies your mobile application to Data 360 and must be in a valid universally unique identifier (UUID) format. An invalid appId results in an error.
endpointstringRequired. The endpoint setting tells the SDK where to send the events being created and tracked.
sessionTimeoutInSecondsintegerThe sessionTimeoutInSeconds setting represents the number of seconds the mobile application can remain in the background before the current session expires. When a customer launches the mobile application, the SDK starts a new session that is maintained while the app is in the foreground. If the customer sends the mobile application to the background, the SDK starts a timer to expire the current session. If the customer brings the mobile app back to the foreground before the session expiration, the timer is cleared and the session continues. Otherwise, the session expires. This field is set to 600 by default.
trackLifecyclebooleanEnable trackLifecycle to automatically track AppForegrounded, AppBackgrounded, and AppVersionChanged behavior events. This field is set to false by default.
trackScreensbooleanEnable trackScreens to automatically track the mobile app ScreenEntry behavior event. This field is set to false by default.
eventFlushRate (iOS)EventFlushRateControls when queued events are flushed to the network. Accepts EventFlushRateQuantity(quantity: n) to flush after accumulating n events, or EventFlushRateQuantityAndInterval(quantity: n, interval: seconds) to flush after n events or after the specified interval in seconds, whichever comes first. This field is set to EventFlushRateQuantity(quantity: 20) by default. Only use EventFlushRateQuantityAndInterval when bounded latency is a requirement (for example, near-real-time analytics). Do not set the interval below 30 seconds. Available in version 3.0.2 and later.
eventFlushRate (Android)EventFlushRateControls when queued events are flushed to the network. Accepts CdpConfig.EventFlushRate.Quantity(n) to flush after accumulating n events, or CdpConfig.EventFlushRate.QuantityAndInterval(n, ms) to flush after n events or after ms milliseconds, whichever comes first. This field is set to Quantity(20) by default. Only use QuantityAndInterval when bounded latency is a requirement (for example, near-real-time analytics). Do not set the interval below 30 seconds (30_000L).
  1. (Optional) To capture debug information and track SDK initialization progress, set up logging before initializing the SDK. Use the setLogger method for iOS and the setLogging method for Android. For more information and example usage, see Logging and Debugging.
  2. Configure the Data 360 Module.
  3. Initialize the Engagement Mobile SDK with the Data 360 Module.

Configuration occurs during the initialization routine of the Mobile application being instrumented.

The SFMCSdk.initializeSdk(_:completionHandler:) method calls the handler once per registered module with its initialization status. Filter by moduleName == ModuleName.cdp to act only on the Data 360 Module result. A status of initStatus == .success means the module is ready to use.