InitializationStatus
MarketingCloudConfig
MarketingCloudSdk
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Package: com.salesforce.marketingcloud
Interfaces: ControlChannel.ControlChannelListener, ModuleInterface
The main SDK class for Salesforce Marketing Cloud Unified SDK. This class provides the primary interface for initializing and interacting with the Marketing Cloud SDK.
1interface InitializationListenerAn interface that provides an InitializationStatus when SDK initialization completes.
1interface WhenReadyListenerAn interface that provides a valid MarketingCloudSdk instance when ready.
1@NonNull
2open val analyticsManager: AnalyticsManagerProvides access to the analytics management functionality.
1@Nullable
2open val instance: MarketingCloudSdkReturns the current SDK instance, or null if not initialized.
1open val isInitializing: BooleanIndicates whether the SDK is currently in the initialization process.
1open val isReady: BooleanIndicates whether the SDK has completed initialization and is ready to use.
1@MainThread
2open fun init(
3 @NonNull context: Context,
4 @NonNull config: MarketingCloudConfig,
5 @Nullable listener: InitializationListener
6)Initializes the SDK with the provided configuration. Must be called from the main thread.
Parameters:
context - Android application contextconfig - Marketing Cloud configuration objectlistener - Optional callback for initialization completion1open fun requestSdk(@NonNull listener: WhenReadyListener)Asynchronous request for an SDK instance.
Parameters:
listener - Callback that receives the SDK instance when ready1open fun requestSdk(
2 @Nullable looper: Looper,
3 @NonNull listener: WhenReadyListener
4)Asynchronous request for an SDK instance with custom looper.
Parameters:
looper - Custom looper for callback executionlistener - Callback that receives the SDK instance when ready1open fun unregisterWhenReadyListener(@NonNull listener: WhenReadyListener)Prevents a WhenReadyListener from receiving the SDK instance.
Parameters:
listener - The listener to unregister1@NonNull
2open fun getMarketingCloudConfig(): MarketingCloudConfigReturns: The MarketingCloudConfig instance used to initialize the SDK.
1@NonNull
2open fun getInitializationStatus(): InitializationStatusReturns: The current initialization status of the SDK.
1@NonNull
2open fun getRegistrationManager(): RegistrationManagerReturns: The registration manager for device registration operations.
1@NonNull
2open fun getInboxMessageManager(): InboxMessageManagerReturns: The inbox message manager for handling inbox messages.
1@NonNull
2open fun getRegionMessageManager(): RegionMessageManagerReturns: The region message manager for location-based messaging.
1@NonNull
2open fun getSdkState(): JSONObjectReturns: A JSON object containing the current state of the SDK.
1@NonNull
2open fun getSdkVersionName(): StringReturns: The version name of the SDK as a string.
1open fun getSdkVersionCode(): IntReturns: The version code of the SDK as an integer.
1open fun setLogLevel(level: Int)Sets the logging level for the SDK.
Parameters:
level - The desired log level1open fun getLogLevel(): IntReturns: The current log level.
1open fun setLogListener(@Nullable logListener: MCLogListener)Sets a custom log listener for SDK logging events.
Parameters:
logListener - Optional custom log listener implementation