Interface Batch.Messaging.LifecycleListener

All Known Subinterfaces:
Batch.Messaging.LifecycleListener2
Enclosing class:
Batch.Messaging

public static interface Batch.Messaging.LifecycleListener
Listener interface for messaging views lifecycle events. Implement this if you want to be notified of what happens to the messaging view (for example, perform some analytics on show/hide). You're also required to implement this if you want to add actions with a "callback" type.
  • Method Details

    • onBatchMessageShown

      void onBatchMessageShown(String messageIdentifier)
      Called when the message view appeared on screen.
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
    • onBatchMessageClosed

      void onBatchMessageClosed(String messageIdentifier)
      Called when the message view disappeared from the screen.
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
    • onBatchMessageActionTriggered

      default void onBatchMessageActionTriggered(String messageIdentifier, int index, BatchMessageAction action)
      Called when the message view will be dismissed due to the user pressing a CTA or the global tap action. Not applicable for the WebView format.
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
      index - Index of the action/CTA. If the action comes from the "global tap action", the index will be Batch.Messaging.GLOBAL_TAP_ACTION_INDEX If the index is greater than or equal to zero, you can cast the action to BatchMessageCTA to get the CTA's label.
      action - Action that will be performed. Fields can be null if the action was only to dismiss the message on tap. DO NOT run the action yourself: the SDK will automatically do it.
    • onBatchMessageWebViewActionTriggered

      default void onBatchMessageWebViewActionTriggered(String messageIdentifier, String analyticsID, BatchMessageAction action)
      Called when the WebView message view will be dismissed due to the user navigating away or triggering an action (using the Javascript SDK).
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
      analyticsID - Analytics identifier. Matches the "analyticsID" parameter of the Javascript call, or the 'batchAnalyticsID' get parameter of a link.
      action - Action that will be performed, can be null. Some fields might be null. DO NOT run the action yourself: the SDK will automatically do it.
    • onBatchMessageCancelledByUser

      default void onBatchMessageCancelledByUser(String messageIdentifier)
      Called when the message view will be dismissed due to the user pressing the close button, or the system's Back button.
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
    • onBatchMessageCancelledByAutoclose

      default void onBatchMessageCancelledByAutoclose(String messageIdentifier)
      Called when the message view will be dismissed due to the auto close timer running out
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.
    • onBatchMessageCancelledByError

      default void onBatchMessageCancelledByError(String messageIdentifier)
      Called when the message view will be dismissed due to an error when loading the message's content. Can only happen on WebView and Image messages.
      Parameters:
      messageIdentifier - Analytics message identifier string. Can be null.