InAppMessagingFeature

Package: com.salesforce.marketingcloud.inappmessagingfeature

Module: In App Messaging Feature Module v1.0.0

SDK: Salesforce Marketing Cloud Unified SDK 11.0.0

Overview 

1class InAppMessagingFeature : ModuleInterface

The InAppMessagingFeature class provides comprehensive functionality for managing in-app messages and related features within the Salesforce Marketing Cloud SDK.

Since: 1.0.0

Key Features 

  • Displaying in-app messages triggered by marketing campaigns
  • Controlling message display with an event listener
  • Customizing message appearance with typeface and status bar color
  • Programmatically showing previously blocked messages

Thread Safety 

This class is thread-safe and uses atomic operations for state management. All public methods can be called from any thread.

Example Usage 

1// Access the InAppMessagingFeature asynchronously
2InAppMessagingFeature.requestSdk { inAppMessagingFeature ->
3  val manager = inAppMessagingFeature.getInAppMessageManager()
4
5  // Set a listener to control message display
6  manager.setInAppMessageListener(object : InAppMessageManager.EventListener {
7    override fun shouldShowMessage(message: InAppMessage): Boolean {
8      // Return true to display the message, false to suppress it
9      return true
10    }
11
12    override fun didShowMessage(message: InAppMessage) {
13      // Called when the message is displayed on screen
14    }
15
16    override fun didCloseMessage(message: InAppMessage, action: InAppMessageCloseAction) {
17      // Called when the message is dismissed
18    }
19  })
20}

Members 

Types 

Companion 

1object Companion

Properties 

state 

1open override val state: JSONObject

Returns the current state of the InAppMessagingFeature module as a JSONObject.

Functions 

getConfig 

1fun getConfig(): InAppMessagingFeatureConfig

Gets the configuration used to initialize this InAppMessagingFeature instance.

Returns: InAppMessagingFeatureConfig


getInAppMessageManager 

1fun getInAppMessageManager(): InAppMessageManager

Gets the In-App Message Manager for managing in-app messages.

Returns: InAppMessageManager


getInitializationStatus 

1fun getInitializationStatus(): InAppMessagingFeatureInitializationStatus?

Gets the initialization status of this InAppMessagingFeature instance.

Returns: InAppMessagingFeatureInitializationStatus?


isTornDown 

1fun isTornDown(): Boolean

Checks if the InAppMessagingFeature instance is torn down.

Returns: Boolean

See Also 

  • InAppMessagingFeatureConfig

Target: androidJvm