public class

InAppMessageManager

extends AirshipComponent
implements InAppMessageScheduler
java.lang.Object
   ↳ com.urbanairship.AirshipComponent
     ↳ com.urbanairship.iam.InAppMessageManager

Class Overview

In-app messaging manager.

Summary

Constants
long DEFAULT_DISPLAY_INTERVAL_MS Default delay between displaying in-app messages.
String EXCLUDE_FROM_AUTO_SHOW Metadata an app can use to prevent an in-app message from showing on a specific activity.
Public Methods
void addListener(InAppMessageListener listener)
Adds a listener.
PendingResult<Boolean> cancelMessage(String messageId)
Cancels an in-app message schedule for the given message ID.
PendingResult<Void> cancelMessages(Collection<String> messageIds)
Message Ids that need to be cancelled.
PendingResult<Void> cancelSchedule(String scheduleId)
Cancels an in-app message schedule.
PendingResult<InAppMessageSchedule> editSchedule(String scheduleId, InAppMessageScheduleEdits edit)
Edits an in-app message schedule.
long getDisplayInterval()
Gets the display interval in milliseconds.
PendingResult<InAppMessageSchedule> getSchedule(String scheduleId)
Gets the schedule.
PendingResult<Collection<InAppMessageSchedule>> getSchedules(String messageId)
Gets the schedules associated with the message ID.
PendingResult<Collection<InAppMessageSchedule>> getSchedules()
Gets all the schedules.
boolean isEnabled()
Returns true if in-app messaging is enabled, false if its disabled.
boolean isPaused()
Returns true if in-app message display is paused, otherwise false.
void onNewConfig(JsonList configList)
Called when a component gets new remote config.
void removeListener(InAppMessageListener listener)
Removes a listener.
PendingResult<List<InAppMessageSchedule>> schedule(List<InAppMessageScheduleInfo> scheduleInfos)
New schedules that need to be scheduled.
PendingResult<InAppMessageSchedule> scheduleMessage(InAppMessageScheduleInfo messageScheduleInfo)
Schedules an in-app message.
void setAdapterFactory(String displayType, InAppMessageAdapter.Factory factory)
Sets a InAppMessageAdapter for a given display type.
void setDisplayInterval(long time, TimeUnit timeUnit)
Sets the in-app message display interval.
void setEnabled(boolean enabled)
Enables or disables in-app messaging.
void setMessageExtender(InAppMessageExtender extender)
Sets the message extender.
void setPaused(boolean paused)
Pauses or unpauses in-app messaging.
Protected Methods
void tearDown()
Tear down the manager.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.iam.InAppMessageScheduler

Constants

public static final long DEFAULT_DISPLAY_INTERVAL_MS

Default delay between displaying in-app messages.

Constant Value: 30000 (0x0000000000007530)

public static final String EXCLUDE_FROM_AUTO_SHOW

Metadata an app can use to prevent an in-app message from showing on a specific activity.

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

Public Methods

public void addListener (InAppMessageListener listener)

Adds a listener.

Parameters
listener The listener.

public PendingResult<Boolean> cancelMessage (String messageId)

Cancels an in-app message schedule for the given message ID. If more than one in-app message shares the same ID, they will all be cancelled.

Parameters
messageId The in-app message's ID.
Returns
  • A pending result.

public PendingResult<Void> cancelMessages (Collection<String> messageIds)

Message Ids that need to be cancelled.

Parameters
messageIds The list of message IDs.
Returns
  • A pending result.

public PendingResult<Void> cancelSchedule (String scheduleId)

Cancels an in-app message schedule.

Parameters
scheduleId The in-app message's schedule ID.
Returns
  • A pending result.

public PendingResult<InAppMessageSchedule> editSchedule (String scheduleId, InAppMessageScheduleEdits edit)

Edits an in-app message schedule.

Parameters
scheduleId The schedule ID.
edit The edits.
Returns
  • A pending result with the updated schedule.

public long getDisplayInterval ()

Gets the display interval in milliseconds.

Returns
  • The display interval in milliseconds.

public PendingResult<InAppMessageSchedule> getSchedule (String scheduleId)

Gets the schedule.

Parameters
scheduleId The schedule ID.
Returns
  • A pending result.

public PendingResult<Collection<InAppMessageSchedule>> getSchedules (String messageId)

Gets the schedules associated with the message ID.

Parameters
messageId The message ID.
Returns
  • A pending result.

public PendingResult<Collection<InAppMessageSchedule>> getSchedules ()

Gets all the schedules.

Returns
  • A pending result.

public boolean isEnabled ()

Returns true if in-app messaging is enabled, false if its disabled.

Returns
  • true if in-app messaging is enabled, false if its disabled.

public boolean isPaused ()

Returns true if in-app message display is paused, otherwise false.

Returns
  • true if in-app message display is paused, otherwise false.

public void onNewConfig (JsonList configList)

Called when a component gets new remote config.

Parameters
configList The config.

public void removeListener (InAppMessageListener listener)

Removes a listener.

Parameters
listener The listener.

public PendingResult<List<InAppMessageSchedule>> schedule (List<InAppMessageScheduleInfo> scheduleInfos)

New schedules that need to be scheduled.

Parameters
scheduleInfos The list of schedule infos.
Returns
  • A pending result.

public PendingResult<InAppMessageSchedule> scheduleMessage (InAppMessageScheduleInfo messageScheduleInfo)

Schedules an in-app message.

Parameters
messageScheduleInfo The in-app message schedule info.
Returns

public void setAdapterFactory (String displayType, InAppMessageAdapter.Factory factory)

Sets a InAppMessageAdapter for a given display type.

Parameters
displayType The display type.
factory The adapter factory.

public void setDisplayInterval (long time, TimeUnit timeUnit)

Sets the in-app message display interval. Defaults to DEFAULT_DISPLAY_INTERVAL_MS.

Parameters
time The display interval.
timeUnit The time unit.

public void setEnabled (boolean enabled)

Enables or disables in-app messaging.

Parameters
enabled true to enable in-app messaging, otherwise false.

public void setMessageExtender (InAppMessageExtender extender)

Sets the message extender. The message will be extended after its been triggered, but before the adapter is created.

Parameters
extender The extender.

public void setPaused (boolean paused)

Pauses or unpauses in-app messaging.

Parameters
paused true to pause in-app message display, otherwise false.

Protected Methods

protected void tearDown ()

Tear down the manager. Called in UAirship during land.