Public classes and enums
The
Message
class contains the definition of an in-app message and controls its tracking via Experience Edge events.Message
objects are only created by the AEPMessaging extension, and passed as the message
parameter in MessagingDelegate
protocol methods.Identifier of the
Message
. This value matches the Message Execution ID assigned by Adobe Journey Optimizer (AJO) Campaign.iOS
Android
Swift
public var id: String
Java
public String id;
If set to
true
(default), Experience Edge events will automatically be generated when this Message
is triggered, displayed, and dismissed.iOS
Android
Swift
public var autoTrack: Bool = true
Java
public boolean autoTrack = true;
Holds a reference to the message's
WKWebView
(iOS) or WebView
(Android) instance, if it exists.iOS
Android
Swift
public var view: UIView? {
fullscreenMessage?.webView
}
Java
public WebView view;
Signals to the UIService (in
AEPServices
) that the message should be shown.If
autoTrack
is true, calling this method will result in an "inapp.trigger" Edge Event being dispatched.iOS
Android
Swift
public func show()
Java
public void show()
Signals to the UIService that the message should be removed from the UI.
If
autoTrack
is true, calling this method will result in an "inapp.dismiss" Edge Event being dispatched.iOS
Android
Swift
public func dismiss(suppressAutoTrack: Bool? = false)
Parameters
- suppressAutoTrack - if set to
true
, the "inapp.dismiss" Edge Event will not be sent regardless of theautoTrack
setting.
Java
public void dismiss(final boolean suppressAutoTrack)
Parameters
- suppressAutoTrack - if set to
true
, the "inapp.dismiss" Edge Event will not be sent regardless of theautoTrack
setting.
Generates and dispatches an Edge Event for the provided
interaction
and eventType
.iOS
Android
Swift
public func track(_ interaction: String?, withEdgeEventType eventType: MessagingEdgeEventType)
Parameters
- interaction - a custom
String
value to be recorded in the interaction
Java
public void track(final String interaction, final MessagingEdgeEventType eventType)
Parameters
- interaction - a custom
String
value to be recorded in the interaction
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.iOS
Android
Swift
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
Java
public 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
Provides mapping to XDM EventType strings needed for Experience Event requests.
iOS
Android
Swift
@objc(AEPMessagingEdgeEventType)
public enum MessagingEdgeEventType: Int {
case inappDismiss = 0
case inappInteract = 1
case inappTrigger = 2
case inappDisplay = 3
case pushApplicationOpened = 4
case pushCustomAction = 5
public func toString() -> String {
switch self {
case .inappDismiss:
return MessagingConstants.XDM.IAM.EventType.DISMISS
case .inappTrigger:
return MessagingConstants.XDM.IAM.EventType.TRIGGER
case .inappInteract:
return MessagingConstants.XDM.IAM.EventType.INTERACT
case .inappDisplay:
return MessagingConstants.XDM.IAM.EventType.DISPLAY
case .pushCustomAction:
return MessagingConstants.XDM.Push.EventType.CUSTOM_ACTION
case .pushApplicationOpened:
return MessagingConstants.XDM.Push.EventType.APPLICATION_OPENED
}
}
}
Java
public enum MessagingEdgeEventType {
IN_APP_DISMISS(0),
IN_APP_INTERACT(1),
IN_APP_TRIGGER(2),
IN_APP_DISPLAY(3),
PUSH_APPLICATION_OPENED(4),
PUSH_CUSTOM_ACTION(5);
final int value;
MessagingEdgeEventType(final int value) {
this.value = value;
}
public int getValue() {
return value;
}
@Override
public String toString() {
switch (this) {
case IN_APP_DISMISS:
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.DISMISS;
case IN_APP_INTERACT:
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.INTERACT;
case IN_APP_TRIGGER:
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.TRIGGER;
case IN_APP_DISPLAY:
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.DISPLAY;
case PUSH_APPLICATION_OPENED:
return MessagingConstants.EventDataKeys.Messaging.PushNotificationDetailsDataKeys.EventType.OPENED;
case PUSH_CUSTOM_ACTION:
return MessagingConstants.EventDataKeys.Messaging.PushNotificationDetailsDataKeys.EventType.CUSTOM_ACTION;
default:
return super.toString();
}
}
Below is the table of values returned by calling the
toString
method for each case, which are used as the XDM eventType
in outgoing experience events:iOS
Android
Case | String value |
---|---|
inappDismiss | inapp.dismiss |
inappInteract | inapp.interact |
inappTrigger | inapp.trigger |
inappDisplay | inapp.display |
pushApplicationOpened | pushTracking.applicationOpened |
pushCustomAction | pushTracking.customAction |
Case | String value |
---|---|
IN_APP_DISMISS | inapp.dismiss |
IN_APP_INTERACT | inapp.interact |
IN_APP_TRIGGER | inapp.trigger |
IN_APP_DISPLAY | inapp.display |
PUSH_APPLICATION_OPENED | pushTracking.applicationOpened |
PUSH_CUSTOM_ACTION | pushTracking.customAction |
Last modified 4mo ago