Edit in GitHubLog an issue

Message

The Message class contains the definition of an in-app message and controls its tracking via Experience Edge events.

iOS Interface - Message

Message objects are only created by the AEPMessaging extension, and passed as the message parameter in MessagingDelegate protocol methods.

Public variables

id

Identifier of the Message. This value matches the Message Execution ID assigned by Adobe Journey Optimizer (AJO) Campaign.

Copied to your clipboard
public var id: String

autoTrack

If set to true (default), Experience Edge events will automatically be generated when this Message is triggered, displayed, and dismissed.

Copied to your clipboard
public var autoTrack: Bool = true

view

Holds a reference to the message's WKWebView (iOS) or WebView (Android) instance, if it exists.

Copied to your clipboard
public var view: UIView? {
fullscreenMessage?.webView
}

Public functions

show

Signals to the UIService (in AEPServices) that the message should be shown.

If autoTrack is true, calling this method will result in an decisioning.propositionTrigger Edge Event being dispatched.

Copied to your clipboard
public func show()

dismiss(suppressAutoTrack:)

Signals to the UIService that the message should be removed from the UI.

If autoTrack is true, calling this method will result in an decisioning.propositionDismiss Edge Event being dispatched.

Copied to your clipboard
public func dismiss(suppressAutoTrack: Bool? = false)
Parameters
  • suppressAutoTrack: If set to true, the decisioning.propositionDismiss Edge Event will not be sent regardless of the autoTrack setting.

track(_:withEdgeEventType:)

Generates and dispatches an Edge Event for the provided interaction and eventType.

Swift

Copied to your clipboard
public func track(_ interaction: String?, withEdgeEventType eventType: MessagingEdgeEventType)
Parameters
  • interaction: A custom String value to be recorded in the interaction
  • eventType: The MessagingEdgeEventType to be used for the ensuing Edge Event

handleJavascriptMessage(_:withHandler:)

Adds a handler for named JavaScript messages sent from the message's WKWebView.

The parameter passed to handler will contain the body of the message passed from the WKWebView's JavaScript.

For a full guide on how to use handleJavascriptMessage, read Call native code from the Javascript of an in-app message.

Swift

Copied to your clipboard
public func handleJavascriptMessage(_ name: String, withHandler handler: @escaping (Any?) -> Void)
Parameters
  • name: The name of the message that should be handled by handler
  • handler: The method or closure to be called with the body of the message created in the Message's JavaScript

Android Interface - Message

The Message class has the business logic related to the in-app message to perform actions like sending tracking events on interactions and suppress tracking. If your app implements PresentationDelegate, it will receive a Presentable object, which is the Mobile Core class containing in-app message view. You will need to get the Message object associated with Presentable object using the MessagingUtils.getMessageForPresentable(Presentable) API. Refer to this tutorial for more details.

Public functions

show

Signals to the UIService that the message should be shown.

If autoTrack is true, calling this method will result in an "decisioning.propositionDisplay" Edge Event being dispatched.

Copied to your clipboard
void show()

dismiss

Signals to the UIService that the message should be removed from the UI.

If autoTrack is true, calling this method will result in an "decisioning.propositionDismiss" Edge Event being dispatched.

Java

Copied to your clipboard
void dismiss()

track

Generates and dispatches an Edge Event for the provided interaction and eventType.

Java

Copied to your clipboard
void track(final String interaction, final MessagingEdgeEventType eventType)
Parameters
  • interaction: A custom String value to be recorded in the interaction
  • eventType: The MessagingEdgeEventType to be used for the ensuing Edge Event

setAutoTrack

Sets the Message's auto tracking preference.

Java

Copied to your clipboard
void setAutoTrack(boolean enabled)
Parameters
  • enabled: If true, Experience Edge events will automatically be generated when this Message is triggered, displayed, or dismissed.

getAutoTrack

Returns the Message's auto tracking preference.

Java

Copied to your clipboard
boolean getAutoTrack()

evaluateJavascript

Evaluates the passed in String content containing JavaScript code using the Message's webview. handleJavascriptMessage must be called with a valid callback before calling evaluateJavascript as the body of the message passed from the JavaScript code execution will be returned in the AdobeCallback .

For a full guide on how to use handleJavascriptMessage, read the guide on executing JavaScript methods from native code.

Java

Copied to your clipboard
void evaluateJavascript(final String content)
Parameters
  • content: A string containing the JavaScript code to be executed

handleJavascriptMessage

Adds a handler for named JavaScript messages sent from the message's WebView.

The AdobeCallback will contain the body of the message passed from the WebView's JavaScript.

For a full guide on how to use handleJavascriptMessage, read the guide on calling native code from the Javascript of an in-app message.

Java

Copied to your clipboard
void handleJavascriptMessage(final String name, final AdobeCallback<String> callback)
Parameters
  • name: The name of the message that should be handled by the callback
  • callback: A callback which will be called with the body of the message created in the Message's JavaScript

getId

Returns the message's id.

Copied to your clipboard
String getId()

getParent

Returns the Object which created this Message.

Copied to your clipboard
Object getParent()

getWebView

Returns a reference to the message's WebView instance, if it exists.

Copied to your clipboard
WebView getWebView()
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.