Class BatchBannerView

java.lang.Object
com.batch.android.BatchBannerView

public class BatchBannerView extends Object
BatchBannerView handles operations related to a Batch In-App Messaging banner, when used in manual mode.

It is not actually a view that you can directly add to your hierarchy. You will have to use show(android.view.View) and dismiss(boolean) to control how it shows up.

  • Method Details

    • show

      public void show(Activity activity)
      Shows the banner for the specified activity. This is equivalent to calling show(findViewById(android.R.id.content)). If you'd like to attach the banner on a CoordinatorLayout, you should use show(android.view.View), or have your activity implement Batch.Messaging.DisplayHintProvider.
      This can only be called once per instance of BatchBannerView, even if dismiss(boolean) has been called.
      You can run this method on any thread.
      Parameters:
      activity - Activity to display the banner on. Can't be null, must currently be onscreen.
    • show

      public void show(View anchorView)
      Shows the banner for the specified anchor view. Just like a Snackbar, the anchor view can be any view from your hierarchy. BatchBannerView will automatically explore your view hierarchy to find the most appropriate view to display itself onto. Usually, this should be a CoordinatorLayout, or your root view.
      This can only be called once per instance of BatchBannerView, even if dismiss(boolean) has been called.
      You can run this method on any thread.
      Parameters:
      anchorView - View used as a base to find the best view to be attached to. Can't be null, must be in your hierarchy.
    • embed

      public void embed(FrameLayout embedLayout)
      Shows the banner in the given layout. Should only be used in very specific cases where none of the automatic display methods are appropriate.
      Do not make any assumption about the views that Batch will add, as it is merely an implementation detail and subject to change.
      Parameters:
      embedLayout - Layout to embed the banner in
    • dismiss

      public void dismiss(boolean animated)
      Dismiss the banner if it's still on screen.

      Calling this doesn't allow you to call show(android.view.View) again.

      Parameters:
      animated - true if the dismissal should be animated, false otherwise