Class InAppMessaging
java.lang.Object
com.wonderpush.sdk.inappmessaging.InAppMessaging
The entry point of the In App Messaging headless SDK.
In-App Messaging will automatically initialize, and start listening for events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceclass -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClickListener(InAppMessagingClickListener clickListener) Registers a click listener with IAM, which will be notified on every IAM clickvoidaddClickListener(InAppMessagingClickListener clickListener, Executor executor) Registers a click listener with IAM, which will be notified on every IAM click, and triggered on the provided executorvoidaddDisplayErrorListener(InAppMessagingDisplayErrorListener displayErrorListener) Registers a display error listener with IAM, which will be notified on every IAM display errorvoidaddDisplayErrorListener(InAppMessagingDisplayErrorListener displayErrorListener, Executor executor) Registers a display error listener with IAM, which will be notified on every IAM display error, and triggered on the provided executorvoidaddImpressionListener(InAppMessagingImpressionListener impressionListener) Registers an impression listener with IAM, which will be notified on every IAM impressionvoidaddImpressionListener(InAppMessagingImpressionListener impressionListener, Executor executor) Registers an impression listener with IAM, which will be notified on every IAM impression, and triggered on the provided executorbooleanDetermine whether messages are suppressed or not.voidRemove previously registered display listeners.voiddisplayInAppMessage(InAppMessage inAppMessage) static InAppMessagingGet InAppMessaging instanceReturns the current display component.static InAppMessaginginitialize(android.app.Application application, com.wonderpush.sdk.InternalEventTracker internalEventTracker, InAppMessaging.InAppMessagingDelegate delegate) Internal method.voidremoveClickListener(InAppMessagingClickListener clickListener) Unregisters a click listenervoidremoveDisplayErrorListener(InAppMessagingDisplayErrorListener displayErrorListener) Unregisters a display error listenervoidremoveImpressionListener(InAppMessagingImpressionListener impressionListener) Unregisters an impression listenervoidsetMessageDisplayComponent(InAppMessagingDisplay messageDisplay) Called to set a new message display component for IAM SDK.voidsetMessagesSuppressed(Boolean areMessagesSuppressed) Enable or disable suppression of In App Messaging messagesvoidtriggerEvent(String eventType) Tell the in-app messaging SDK that an event of the given type was triggered.
-
Method Details
-
initialize
@NonNull public static InAppMessaging initialize(android.app.Application application, com.wonderpush.sdk.InternalEventTracker internalEventTracker, InAppMessaging.InAppMessagingDelegate delegate) Internal method. -
getInstance
Get InAppMessaging instance -
setMessagesSuppressed
Enable or disable suppression of In App Messaging messagesWhen enabled, no in app messages will be rendered until either you either disable suppression, or the app restarts, as this state is not preserved over app restarts.
By default, messages are not suppressed.
- Parameters:
areMessagesSuppressed- Whether messages should be suppressed
-
areMessagesSuppressed
public boolean areMessagesSuppressed()Determine whether messages are suppressed or not. This is honored by the UI sdk, which handles rendering the in app message.- Returns:
- true if messages should be suppressed
-
getMessageDisplayComponent
Returns the current display component. Unless you've set your own withsetMessageDisplayComponent(InAppMessagingDisplay), this will be the built-in display component.- Returns:
- The current display component.
-
setMessageDisplayComponent
Called to set a new message display component for IAM SDK. This is the method used by both the default IAM display SDK or any app wanting to customize the message display. -
clearDisplayListener
public void clearDisplayListener()Remove previously registered display listeners. -
addImpressionListener
Registers an impression listener with IAM, which will be notified on every IAM impression- Parameters:
impressionListener-
-
addClickListener
Registers a click listener with IAM, which will be notified on every IAM click- Parameters:
clickListener-
-
addDisplayErrorListener
public void addDisplayErrorListener(@NonNull InAppMessagingDisplayErrorListener displayErrorListener) Registers a display error listener with IAM, which will be notified on every IAM display error- Parameters:
displayErrorListener-
-
addImpressionListener
public void addImpressionListener(@NonNull InAppMessagingImpressionListener impressionListener, @NonNull Executor executor) Registers an impression listener with IAM, which will be notified on every IAM impression, and triggered on the provided executor- Parameters:
impressionListener-executor-
-
addClickListener
public void addClickListener(@NonNull InAppMessagingClickListener clickListener, @NonNull Executor executor) Registers a click listener with IAM, which will be notified on every IAM click, and triggered on the provided executor- Parameters:
clickListener-executor-
-
addDisplayErrorListener
public void addDisplayErrorListener(@NonNull InAppMessagingDisplayErrorListener displayErrorListener, @NonNull Executor executor) Registers a display error listener with IAM, which will be notified on every IAM display error, and triggered on the provided executor- Parameters:
displayErrorListener-executor-
-
removeImpressionListener
Unregisters an impression listener- Parameters:
impressionListener-
-
removeClickListener
Unregisters a click listener- Parameters:
clickListener-
-
removeDisplayErrorListener
public void removeDisplayErrorListener(@NonNull InAppMessagingDisplayErrorListener displayErrorListener) Unregisters a display error listener- Parameters:
displayErrorListener-
-
triggerEvent
Tell the in-app messaging SDK that an event of the given type was triggered. Useful for testing.- Parameters:
eventType-
-
displayInAppMessage
-