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 Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void onBatchMessageActionTriggered​(java.lang.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.
      default void onBatchMessageCancelledByAutoclose​(java.lang.String messageIdentifier)
      Called when the message view will be dismissed due to the auto close timer running out
      default void onBatchMessageCancelledByError​(java.lang.String messageIdentifier)
      Called when the message view will be dismissed due to an error when loading the message's content.
      default void onBatchMessageCancelledByUser​(java.lang.String messageIdentifier)
      Called when the message view will be dismissed due to the user pressing the close button, or the system's Back button.
      void onBatchMessageClosed​(java.lang.String messageIdentifier)
      Called when the message view disappeared from the screen.
      void onBatchMessageShown​(java.lang.String messageIdentifier)
      Called when the message view appeared on screen.
      default void onBatchMessageWebViewActionTriggered​(java.lang.String messageIdentifier, java.lang.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).
    • Method Detail

      • onBatchMessageShown

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

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

        default void onBatchMessageActionTriggered​(@Nullable
                                                   java.lang.String messageIdentifier,
                                                   int index,
                                                   @NonNull
                                                   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​(@Nullable
                                                          java.lang.String messageIdentifier,
                                                          @Nullable
                                                          java.lang.String analyticsID,
                                                          @Nullable
                                                          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​(@Nullable
                                                   java.lang.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​(@Nullable
                                                        java.lang.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​(@Nullable
                                                    java.lang.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.