showView

open fun showView(@NonNull activity: Activity)

Shows the BatchMessagingView for the specified activity.

This is equivalent to calling show(findViewById(android.R.id.content)). If you'd like to attach the message on a CoordinatorLayout, you should use showView, or have your activity implement Batch.Messaging.DisplayHintProvider.

This can only be called once per instance of BatchMessagingView, even if dismissView has been called.

You can run this method on any thread.

You should check the kind of view before calling this method.

Parameters

activity

Activity to display the banner on. Can't be null, must currently be onscreen.


open fun showView(@NonNull anchorView: View)

Show the wrapped value as a View for the specified anchor view.

Just like a Snack bar, the anchor view can be any view from your hierarchy. BatchMessagingView 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 dismissView has been called.

You can run this method on any thread.

You should check the kind of view before calling this method.

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.