Marketing Cloud SDK / com.salesforce.marketingcloud / MarketingCloudSdk

MarketingCloudSdk

class MarketingCloudSdk : ControlChannelListener

Types

InitializationListener

Returns an instance of InitializationStatus when the initialization of MarketingCloudSdk has completed.

interface InitializationListener

WhenReadyListener

Returns a valid instance of MarketingCloudSdk when it is ready. If initialization of the SDK has already completed then ready will be called immediately. If init has not been called, or is executing, ready will be called upon completion. Note: If init completes with a status of FAILED #ready(MarketingCloudSdk) ready will not be called, and the current list of WhenReadyListener listeners will be cleared.

interface WhenReadyListener

Functions

getAnalyticsManager

fun getAnalyticsManager(): AnalyticsManager

getInAppMessageManager

fun getInAppMessageManager(): InAppMessageManager

getInboxMessageManager

fun getInboxMessageManager(): InboxMessageManager

getInitializationStatus

fun getInitializationStatus(): InitializationStatus

getInstance

Returns an instance of the MarketingCloudSdk. An IllegalStateException will be thrown if this method is called before init. Note: This method will block the calling thread if init has not finished.

static fun getInstance(): MarketingCloudSdk?

getLogLevel

static fun getLogLevel(): Int

getMarketingCloudConfig

Returns the MarketingCloudConfig instance used to initialize the MarketingCloudSdk.

fun getMarketingCloudConfig(): MarketingCloudConfig

getNotificationManager

fun getNotificationManager(): NotificationManager

getPushMessageManager

fun getPushMessageManager(): PushMessageManager

getRegionMessageManager

fun getRegionMessageManager(): RegionMessageManager

getRegistrationManager

fun getRegistrationManager(): RegistrationManager

getSdkState

fun getSdkState(): JSONObject

getSdkVersionCode

static fun getSdkVersionCode(): Int

getSdkVersionName

static fun getSdkVersionName(): String

init

Initializes the SDK with the provided config. Once complete, the will be notified. Any subsequent calls to this method will be ignored as long as the values provided in are the same. Note: Anyone that requested the sdk before or during the initialization will be notified before the listener will be notified.

static fun init(context: Context, config: MarketingCloudConfig, listener: InitializationListener?): Unit

isInitializing

Indicates whether the sdk is currently executing its initialization routine.

static fun isInitializing(): Boolean

isReady

Indicates whether or not there is a valid instance of MarketingCloudSdk that is ready(initialized) to be used. If the value is true then calls to will not block the thread.

static fun isReady(): Boolean

requestSdk

An asynchronous request for an instance of MarketingCloudSdk.

static fun requestSdk(listener: WhenReadyListener): Unit

An asynchronous request for a instance of MarketingCloudSdk.

static fun requestSdk(looper: Looper?, listener: WhenReadyListener): Unit

setLogLevel

static fun setLogLevel(level: Int): Unit

setLogListener

static fun setLogListener(logListener: MCLogListener?): Unit

unregisterWhenReadyListener

Prevents a WhenReadyListener from returning an instance of MarketingCloudSdk

static fun unregisterWhenReadyListener(listener: WhenReadyListener): Unit