public class PushBuilder
- Object
- PushBuilder
Constructors
public PushBuilder() |
Methods
public PushBuilder title(String title) | Sets the title of the push notification. |
public PushBuilder badge(int badge) | Sets the badge to set with the push notification. |
public PushBuilder body(String body) | Sets the body of the push notification. |
public PushBuilder metaData(String metaData) | Sets the metadata (i.e. content the user shouldn’t see) for the push notification. |
public PushBuilder imageUrl(String imageUrl) | Sets the URL for an image to send in the push notification. |
public PushBuilder category(String category) | Sets the category of the push notification. |
public PushBuilder type(int type) | Sets the type of the push notification. |
public boolean isRichPush() | A notification is considered to be a rich push notification if either #imageUrl or #category is set. |
public int getType() | Gets the type of the notification. |
public String build() | Builds the payload for this rich push notification. |
Inherited methods
Constructor details
PushBuilder
public PushBuilder()Method details
title
public PushBuilder title(String title)Parameters
titleString- The title of the push notification.
Returns
badge
public PushBuilder badge(int badge)Parameters
badgeint- The badge to set.
Returns
body
public PushBuilder body(String body)Parameters
bodyString- The body of the push notification.
Returns
metaData
public PushBuilder metaData(String metaData)Parameters
metaDataString- The metadata.
Returns
imageUrl
public PushBuilder imageUrl(String imageUrl)Parameters
imageUrlString- The image URL.
Returns
category
public PushBuilder category(String category)Parameters
categoryString- The category.
Returns
type
public PushBuilder type(int type)Sets the type of the push notification.
Types
TypeDescription 1Sends only body as the notification message 2Sends only metadata. Invisible to user but will be received in push callback 3Sends both metadata and body. Body is visible to the user. Push callback will receive <metadata>;<body>. 4Sends both title and body. Push callback will receive <title>;<body> 100Sends only the badge 101Sends the badge and body. Push callback will receive the body only. 102Sends the badge, title, and body. Push callback will receive <title>;<body>
Both #imageUrl and #category can be added to any notification type. If either of these values are non-null,
then the push notification is considered to be a rich push notification, and #getType() will return 99,
which signifies that it is a rich push notification.
Parameters
typeint- The type of the push notification.
Returns
isRichPush
public boolean isRichPush()#imageUrl or #category is set.Returns
getType
public int getType()#isRichPush() is true. Otherwise
it will return the underlying type as set with #type(int).Returns
See also
build
public String build()Returns
Push