public class

BannerAdapter

extends MediaDisplayAdapter
java.lang.Object
   ↳ com.urbanairship.iam.MediaDisplayAdapter
     ↳ com.urbanairship.iam.banner.BannerAdapter

Class Overview

Banner display adapter.

Summary

Constants
String BANNER_CONTAINER_ID Metadata an app can use to specify the banner's container ID per activity.
[Expand]
Inherited Constants
From interface com.urbanairship.iam.InAppMessageAdapter
Protected Constructors
BannerAdapter(InAppMessage message, BannerDisplayContent displayContent)
Default constructor.
Public Methods
static BannerAdapter newAdapter(InAppMessage message)
Creates a new banner adapter.
boolean onDisplay(Activity activity, boolean isRedisplay, DisplayHandler displayHandler)
Called to display an in-app message.
Protected Methods
int getContainerId(Activity activity)
Gets the Banner fragment's container ID.
[Expand]
Inherited Methods
From class com.urbanairship.iam.MediaDisplayAdapter
From class java.lang.Object
From interface com.urbanairship.iam.InAppMessageAdapter

Constants

public static final String BANNER_CONTAINER_ID

Metadata an app can use to specify the banner's container ID per activity.

Constant Value: "com.urbanairship.iam.banner.BANNER_CONTAINER_ID"

Protected Constructors

protected BannerAdapter (InAppMessage message, BannerDisplayContent displayContent)

Default constructor.

Parameters
message The in-app message.
displayContent The display content.

Public Methods

public static BannerAdapter newAdapter (InAppMessage message)

Creates a new banner adapter.

Parameters
message The in-app message.
Returns
  • The banner adapter.

public boolean onDisplay (Activity activity, boolean isRedisplay, DisplayHandler displayHandler)

Called to display an in-app message. The display handler's requestDisplayLock(Activity) must be called during `onStart()` in either the activity or fragment, and if the request is denied must immediately dismiss the component without any other calls to the display handler. Once the activity or fragment is finished being displayed call finished(ResolutionInfo).

Parameters
activity The current resumed activity.
isRedisplay true If the in-app message is being redisplayed, otherwise false.
displayHandler The display handler.
Returns
  • true if the in-app message was able to be displayed, otherwise false to try again later.

Protected Methods

protected int getContainerId (Activity activity)

Gets the Banner fragment's container ID. The default implementation checks the activities metadata for BANNER_CONTAINER_ID and falls back to `android.R.id.content`.

Parameters
activity The activity.
Returns
  • The container ID.