public interface

InAppMessageAdapter

com.urbanairship.iam.InAppMessageAdapter
Known Indirect Subclasses

Class Overview

In-app message adapter. An adapter is responsible for displaying a particular type of in-app message.

Summary

Nested Classes
interface InAppMessageAdapter.Factory Factory interface for InAppMessageAdapters. 
@interface InAppMessageAdapter.PrepareResult  
Constants
int CANCEL Indicates that the prepare step failed and the schedule should be canceled.
int OK Indicates a successful result.
int RETRY Indicates that the the prepare step should be retried.
Public Methods
abstract boolean isReady(Activity activity)
Called before displaying but after the message is prepared.
abstract boolean onDisplay(Activity activity, boolean isRedisplay, DisplayHandler displayHandler)
Called to display an in-app message.
abstract void onFinish()
Called after the in-app message is finished displaying.
abstract int onPrepare(Context context)
Called before onDisplay(Activity, boolean, DisplayHandler) to prepare the message to be displayed.

Constants

public static final int CANCEL

Indicates that the prepare step failed and the schedule should be canceled.

Constant Value: 2 (0x00000002)

public static final int OK

Indicates a successful result.

Constant Value: 0 (0x00000000)

public static final int RETRY

Indicates that the the prepare step should be retried.

Constant Value: 1 (0x00000001)

Public Methods

public abstract boolean isReady (Activity activity)

Called before displaying but after the message is prepared.

Parameters
activity The current resumed activity.
Returns
  • true if the message is ready to be displayed, otherwise false.

public abstract 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.

public abstract void onFinish ()

Called after the in-app message is finished displaying. Perform any cache clean up here.

public abstract int onPrepare (Context context)

Called before onDisplay(Activity, boolean, DisplayHandler) to prepare the message to be displayed.

Parameters
context The application context.
Returns
  • OK if the in-app message is ready to be displayed, RETRY if the message was unable to be prepared and needs to be retried, or CANCEL if the message was unable to be prepared and should be canceled.