public static class

InAppMessage.Builder

extends Object
java.lang.Object
   ↳ com.urbanairship.push.iam.InAppMessage.Builder

Class Overview

InAppMessage Builder.

Summary

Public Constructors
InAppMessage.Builder()
Default constructor.
InAppMessage.Builder(InAppMessage message)
Creates a new Builder with the values of the specified message.
Public Methods
InAppMessage create()
Creates the message.
InAppMessage.Builder setAlert(String alert)
Sets the message's alert.
InAppMessage.Builder setButtonActionValues(String buttonId, Map<StringActionValue> actionValues)
Sets the message's button actions for a given button ID.
InAppMessage.Builder setButtonGroupId(String buttonGroupId)
Sets the message's button group ID.
InAppMessage.Builder setClickActionValues(Map<StringActionValue> actionValues)
Sets the message's on click action values.
InAppMessage.Builder setDuration(Long milliseconds)
Sets the duration to show the message for.
InAppMessage.Builder setExpiry(Long milliseconds)
Sets the message's expiry in milliseconds.
InAppMessage.Builder setExtras(JsonMap extras)
Sets the message's extras.
InAppMessage.Builder setPosition(int position)
Sets the message's position.
InAppMessage.Builder setPrimaryColor(Integer color)
Sets the message's primary color.
InAppMessage.Builder setSecondaryColor(Integer color)
Sets the message's secondary color.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public InAppMessage.Builder ()

Default constructor.

public InAppMessage.Builder (InAppMessage message)

Creates a new Builder with the values of the specified message.

Parameters
message The message.

Public Methods

public InAppMessage create ()

Creates the message.

Returns
  • The created in-app message.

public InAppMessage.Builder setAlert (String alert)

Sets the message's alert.

Parameters
alert The message's alert.
Returns
  • The builder.

public InAppMessage.Builder setButtonActionValues (String buttonId, Map<StringActionValue> actionValues)

Sets the message's button actions for a given button ID.

Parameters
buttonId The button's ID.
actionValues The button's action values.
Returns
  • The builder.

public InAppMessage.Builder setButtonGroupId (String buttonGroupId)

Sets the message's button group ID.

Parameters
buttonGroupId The message's button group ID.
Returns
  • The builder.

public InAppMessage.Builder setClickActionValues (Map<StringActionValue> actionValues)

Sets the message's on click action values.

Parameters
actionValues The message's on click action values.
Returns
  • The builder.

public InAppMessage.Builder setDuration (Long milliseconds)

Sets the duration to show the message for.

Parameters
milliseconds The duration in milliseconds.
Returns
  • The builder.
Throws
IllegalArgumentException if the duration is less than or equal to 0.

public InAppMessage.Builder setExpiry (Long milliseconds)

Sets the message's expiry in milliseconds. If no expiry is set, it will default to 30 days from the creation date.

Parameters
milliseconds The expiry date in milliseconds.
Returns
  • The builder.

public InAppMessage.Builder setExtras (JsonMap extras)

Sets the message's extras.

Parameters
extras The message's extras.
Returns
  • The builder.

public InAppMessage.Builder setPosition (int position)

Sets the message's position. Either POSITION_BOTTOM or POSITION_TOP are acceptable values. Any other value will result in an illegal argument exception.

Parameters
position The message's position.
Returns
  • The builder.
Throws
IllegalArgumentException If the position is not POSITION_BOTTOM nor POSITION_TOP.

public InAppMessage.Builder setPrimaryColor (Integer color)

Sets the message's primary color.

Parameters
color The message's primary color.
Returns
  • The builder.

public InAppMessage.Builder setSecondaryColor (Integer color)

Sets the message's secondary color.

Parameters
color The message's secondary color.
Returns
  • The builder.