Public classes and enums

Class - Message

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.

Public variables

id

Identifier of the Message. This value matches the Message Execution ID assigned by Adobe Journey Optimizer (AJO) Campaign.
iOS
Android
Swift
1
public var id: String
Copied!
Java
1
public String id;
Copied!

autoTrack

If set to true (default), Experience Edge events will automatically be generated when this Message is triggered, displayed, and dismissed.
iOS
Android
Swift
1
public var autoTrack: Bool = true
Copied!
Java
1
public boolean autoTrack = true;
Copied!

view

Holds a reference to the message's WKWebView (iOS) or WebView (Android) instance, if it exists.
iOS
Android
Swift
1
public var view: UIView? {
2
fullscreenMessage?.webView
3
}
Copied!
Java
1
public WebView view;
Copied!

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 "inapp.trigger" Edge Event being dispatched.
iOS
Android
Swift
1
public func show()
Copied!
Java
1
public void show()
Copied!

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 "inapp.dismiss" Edge Event being dispatched.
iOS
Android
Swift
1
public func dismiss(suppressAutoTrack: Bool? = false)
Copied!
Parameters
  • suppressAutoTrack - if set to true, the "inapp.dismiss" Edge Event will not be sent regardless of the autoTrack setting.
Java
1
public void dismiss(final boolean suppressAutoTrack)
Copied!
Parameters
  • suppressAutoTrack - if set to true, the "inapp.dismiss" 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.
iOS
Android
Swift
1
public func track(_ interaction: String?, withEdgeEventType eventType: MessagingEdgeEventType)
Copied!
Parameters
  • interaction - a custom String value to be recorded in the interaction
  • eventType - the MessagingEdgeEventType to be used for the ensuing Edge Event
Java
1
public void track(final String interaction, final MessagingEdgeEventType eventType)
Copied!
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.
iOS
Android
Swift
1
public func handleJavascriptMessage(_ name: String, withHandler handler: @escaping (Any?) -> Void)
Copied!
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
1
public void handleJavascriptMessage(final String name, final AdobeCallback<String> callback)
Copied!
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

Enum - MessagingEdgeEventType

Provides mapping to XDM EventType strings needed for Experience Event requests.
This enum is used in conjunction with the track(_:withEdgeEventType:) method of a Message object.

Definition

iOS
Android
Swift
1
@objc(AEPMessagingEdgeEventType)
2
public enum MessagingEdgeEventType: Int {
3
case inappDismiss = 0
4
case inappInteract = 1
5
case inappTrigger = 2
6
case inappDisplay = 3
7
case pushApplicationOpened = 4
8
case pushCustomAction = 5
9
10
public func toString() -> String {
11
switch self {
12
case .inappDismiss:
13
return MessagingConstants.XDM.IAM.EventType.DISMISS
14
case .inappTrigger:
15
return MessagingConstants.XDM.IAM.EventType.TRIGGER
16
case .inappInteract:
17
return MessagingConstants.XDM.IAM.EventType.INTERACT
18
case .inappDisplay:
19
return MessagingConstants.XDM.IAM.EventType.DISPLAY
20
case .pushCustomAction:
21
return MessagingConstants.XDM.Push.EventType.CUSTOM_ACTION
22
case .pushApplicationOpened:
23
return MessagingConstants.XDM.Push.EventType.APPLICATION_OPENED
24
}
25
}
26
}
Copied!
Java
1
public enum MessagingEdgeEventType {
2
IN_APP_DISMISS(0),
3
IN_APP_INTERACT(1),
4
IN_APP_TRIGGER(2),
5
IN_APP_DISPLAY(3),
6
PUSH_APPLICATION_OPENED(4),
7
PUSH_CUSTOM_ACTION(5);
8
9
final int value;
10
11
MessagingEdgeEventType(final int value) {
12
this.value = value;
13
}
14
15
public int getValue() {
16
return value;
17
}
18
19
@Override
20
public String toString() {
21
switch (this) {
22
case IN_APP_DISMISS:
23
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.DISMISS;
24
case IN_APP_INTERACT:
25
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.INTERACT;
26
case IN_APP_TRIGGER:
27
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.TRIGGER;
28
case IN_APP_DISPLAY:
29
return MessagingConstants.EventDataKeys.Messaging.IAMDetailsDataKeys.EventType.DISPLAY;
30
case PUSH_APPLICATION_OPENED:
31
return MessagingConstants.EventDataKeys.Messaging.PushNotificationDetailsDataKeys.EventType.OPENED;
32
case PUSH_CUSTOM_ACTION:
33
return MessagingConstants.EventDataKeys.Messaging.PushNotificationDetailsDataKeys.EventType.CUSTOM_ACTION;
34
default:
35
return super.toString();
36
}
37
}
Copied!

String values

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