public final class PushContent

  1. Object
  2. PushContent
Encapsulates the content of a Push message. Use this class inside the PushCallback#push(java.lang.String) method to retrieve details of the push, including title, body, image URL, category, type, and metadata if available.

Methods

public static boolean exists()Checks if there is pending push content to retrieve.
public static PushContent get()Gets the most recent push notification content if it exists.
public static void reset()Resets the push content.
public String getTitle()Gets the title of the Push content.
public static void setTitle(String title)Deprecated Sets the title of the pending push content.
public String getBody()Gets the body of the push content.
public static void setBody(String body)Deprecated Sets the body of pending push content.
public String getImageUrl()Gets the image URL of the push content.
public static void setImageUrl(String imageUrl)Deprecated Sets the image URL of pending push content.
public String getCategory()Gets category of the push content.
public static void setCategory(String category)Deprecated Sets the category of the pending push content.
public String getMetaData()Gets the metadata associated with push.
public static void setMetaData(String metaData)Deprecated Sets the metadata of pending push content.
public int getType()Gets the type of the push content.
public static void setType(int type)Deprecated Sets the type of the push content.
public String getActionId()If the user selected an action on the push notification, then the ID of the selected action will be stored in the PushContent’s actionId.
public static void setActionId(String actionId)Deprecated Sets the action ID of the push content.
public String getActionTitle()If the user selected an action on the notification, then the title (button label) of the selected action is available here.
public static void setActionTitle(String actionTitle)Deprecated Sets the action title of the notification content.
public String getTextResponse()If the push notification action included a text field for the user to enter a response, then that response will be returned here.
public static void setTextResponse(String textResponse)Deprecated Sets the text response for the notification.

Inherited methods

Method details

exists

public static boolean exists()
Checks if there is pending push content to retrieve.

Returns

True if there is pending push content to retrieve.

get

public static PushContent get()

Gets the most recent push notification content if it exists. This functions like Stack.pop() for a single-element stack. I.e. In addition to returning the PushContent, that push content is removed from the queue.

if (PushContent.exists()) { PushContent content = PushContent.get(); // content should be non-null PushContent content2 = PushContent.get(); // content2 should be null PushContent.exists(); // false }

Returns

Pending push content if it exists.

reset

public static void reset()
Resets the push content. After calling this, PushContent#exists() will return false.

getTitle

public String getTitle()
Gets the title of the Push content.

Returns

the title

setTitle

public static void setTitle(String title)
Deprecated. For internal use only.
Sets the title of the pending push content.

Parameters

title String
the title to set

getBody

public String getBody()
Gets the body of the push content.

Returns

the body

setBody

public static void setBody(String body)
Deprecated. For internal use only
Sets the body of pending push content.

Parameters

body String
the body to set

getImageUrl

public String getImageUrl()
Gets the image URL of the push content.

Returns

the imageUrl

setImageUrl

public static void setImageUrl(String imageUrl)
Deprecated. For internal use only.
Sets the image URL of pending push content.

Parameters

imageUrl String
the imageUrl to set

getCategory

public String getCategory()
Gets category of the push content.

Returns

the category

setCategory

public static void setCategory(String category)
Deprecated. For internal use only.
Sets the category of the pending push content.

Parameters

category String
the category to set

getMetaData

public String getMetaData()
Gets the metadata associated with push. This is hidden content not shown to the user.

Returns

the metaData

setMetaData

public static void setMetaData(String metaData)
Deprecated. For internal use only.
Sets the metadata of pending push content.

Parameters

metaData String
the metaData to set

getType

public int getType()
Gets the type of the push content.

Returns

the type of the push content.

setType

public static void setType(int type)
Deprecated. For internal use only.
Sets the type of the push content.

Parameters

type int
the type to set

getActionId

public String getActionId()
If the user selected an action on the push notification, then the ID of the selected action will be stored in the PushContent’s actionId. If the user did not tap an action, then this will be null.

Returns

The action ID that was selected by the user.

setActionId

public static void setActionId(String actionId)
Deprecated. For internal use only.
Sets the action ID of the push content. The action ID is only set if the user tapped on one of the actions in the push notification; and, if set, it will be set to the ID of the action that was selected.

Parameters

actionId String
The ID of the action that was selected by the user.

getActionTitle

public String getActionTitle()
If the user selected an action on the notification, then the title (button label) of the selected action is available here. This applies both to push notification actions and to local notification actions. If the user did not tap an action, this is null.

Returns

The title of the action that was selected by the user, or null.

setActionTitle

public static void setActionTitle(String actionTitle)
Deprecated. For internal use only.
Sets the action title of the notification content.

Parameters

actionTitle String
the title of the action that was selected

getTextResponse

public String getTextResponse()
If the push notification action included a text field for the user to enter a response, then that response will be returned here. For notifications that don’t include a response, this will return null.

Returns

The action ID that was selected by the user.

setTextResponse

public static void setTextResponse(String textResponse)
Deprecated. For internal use only.
Sets the text response for the notification. Only applies to notifications where the user has entered a text response.