public class

InAppMessageManager

extends BaseManager
java.lang.Object
   ↳ com.urbanairship.BaseManager
     ↳ com.urbanairship.push.iam.InAppMessageManager

Class Overview

This class is the primary interface for interacting with in-app messages.

Summary

Nested Classes
interface InAppMessageManager.Listener Listener for in-app messaging receive and display events. 
Constants
String EXCLUDE_FROM_AUTO_SHOW Activity metadata key to exclude an activity from automatically displaying an in-app message.
Public Methods
void addListener(InAppMessageManager.Listener listener)
Subscribe a listener for in-app message events.
long getAutoDisplayDelay()
Gets the delay in milliseconds before an in-app message is automatically displayed when an activity is resumed.
InAppMessageFragmentFactory getFragmentFactory()
Returns the current in-app message fragment factory.
InAppMessage getPendingMessage()
Gets the pending in-app message.
boolean isAutoDisplayEnabled()
Checks if auto displaying in-app messages is enabled.
boolean isDisplayAsapEnabled()
Checks in-app messages should be displayed as soon as possible or only on app foregrounds.
void removeListener(InAppMessageManager.Listener listener)
Unsubscribe a listener for in-app message events.
void setAutoDisplayDelay(long milliseconds)
Sets the default delay before an in-app message is automatically displayed when an activity is resumed.
void setAutoDisplayEnabled(boolean enabled)
Sets if in-app messages should be displayed automatically.
void setDisplayAsapEnabled(boolean enabled)
Sets if in-app messages should be displayed as soon as possible or only on app foregrounds.
void setFragmentFactory(InAppMessageFragmentFactory factory)
Sets the the in-app message fragment factory.
void setPendingMessage(InAppMessage message)
Sets the pending in-app message.
boolean showPendingMessage(Activity activity, int containerId)
Shows the pending in-app message in a specified container ID.
boolean showPendingMessage(Activity activity, int containerId, int enterAnimation, int exitAnimation)
Shows the pending in-app message in a specified container ID and fragment animations.
boolean showPendingMessage(Activity activity)
Shows the pending in-app message.
Protected Methods
void init()
Initialize the manager.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String EXCLUDE_FROM_AUTO_SHOW

Activity metadata key to exclude an activity from automatically displaying an in-app message.

Constant Value: "com.urbanairship.push.iam.EXCLUDE_FROM_AUTO_SHOW"

Public Methods

public void addListener (InAppMessageManager.Listener listener)

Subscribe a listener for in-app message events.

Parameters
listener An object implementing the InAppMessageManager.Listener interface.

public long getAutoDisplayDelay ()

Gets the delay in milliseconds before an in-app message is automatically displayed when an activity is resumed.

Returns
  • The auto display delay in milliseconds.

public InAppMessageFragmentFactory getFragmentFactory ()

Returns the current in-app message fragment factory.

Returns
  • The current in-app message fragment factory.

public InAppMessage getPendingMessage ()

Gets the pending in-app message.

Returns
  • The pending in-app message.

public boolean isAutoDisplayEnabled ()

Checks if auto displaying in-app messages is enabled.

Returns
  • true if displaying in-app messages automatically is enabled, otherwise false.

public boolean isDisplayAsapEnabled ()

Checks in-app messages should be displayed as soon as possible or only on app foregrounds.

Returns
  • true if in-app messages as soon as possible is enabled, otherwise false.

public void removeListener (InAppMessageManager.Listener listener)

Unsubscribe a listener for in-app message events.

Parameters
listener An object implementing the InAppMessageManager.Listener interface.

public void setAutoDisplayDelay (long milliseconds)

Sets the default delay before an in-app message is automatically displayed when an activity is resumed.

Parameters
milliseconds The auto display delay in milliseconds.

public void setAutoDisplayEnabled (boolean enabled)

Sets if in-app messages should be displayed automatically.

Parameters
enabled true to display in-app messages automatically, otherwise false.

public void setDisplayAsapEnabled (boolean enabled)

Sets if in-app messages should be displayed as soon as possible or only on app foregrounds.

If a pending in-app message is already available, it will be displayed on the next time an activity is resumed.

Parameters
enabled true to enable display in-app messages as soon as possible, otherwise false.

public void setFragmentFactory (InAppMessageFragmentFactory factory)

Sets the the in-app message fragment factory. The factory can be used to provide a customized in-app message fragment to provide a different look and feel for in-app messages.

Parameters
factory The InAppMessageFragmentFactory.

public void setPendingMessage (InAppMessage message)

Sets the pending in-app message.

Parameters
message The in-app message.

public boolean showPendingMessage (Activity activity, int containerId)

Shows the pending in-app message in a specified container ID.

Parameters
activity The current activity.
containerId An ID of a container in the activity's view to add the InAppMessageFragment.
Returns

public boolean showPendingMessage (Activity activity, int containerId, int enterAnimation, int exitAnimation)

Shows the pending in-app message in a specified container ID and fragment animations.

Note: The animations must refer to API 11 object animators. View animators will result in a runtime exception.

Parameters
activity The current activity.
containerId An ID of a container in the activity's view to add the InAppMessageFragment.
enterAnimation The animation resource to run when the InAppMessageFragment enters the view.
exitAnimation The animation resource to run when the InAppMessageFragment exits the view.
Returns

public boolean showPendingMessage (Activity activity)

Shows the pending in-app message.

Parameters
activity The current activity.
Returns

Protected Methods

protected void init ()

Initialize the manager. Called in UAirship during takeoff.