public class PushBuilder extends Object
Constructor and Description |
---|
PushBuilder() |
Modifier and Type | Method and Description |
---|---|
PushBuilder |
badge(int badge)
Sets the badge to set with the push notification.
|
PushBuilder |
body(String body)
Sets the body of the push notification.
|
String |
build()
Builds the payload for this rich push notification.
|
PushBuilder |
category(String category)
Sets the category of the push notification.
|
int |
getType()
Gets the type of the notification.
|
PushBuilder |
imageUrl(String imageUrl)
Sets the URL for an image to send in the push notification.
|
boolean |
isRichPush()
|
PushBuilder |
metaData(String metaData)
Sets the metadata (i.e.
|
PushBuilder |
title(String title)
Sets the title of the push notification.
|
PushBuilder |
type(int type)
Sets the type of the push notification.
|
public PushBuilder title(String title)
title
- The title of the push notification.public PushBuilder badge(int badge)
badge
- The badge to set.public PushBuilder body(String body)
body
- The body of the push notification.public PushBuilder metaData(String metaData)
metaData
- The metadata.public PushBuilder imageUrl(String imageUrl)
imageUrl
- The image URL.public PushBuilder category(String category)
category
- The category.public PushBuilder type(int type)
Types
Type | Description |
---|---|
1 | Sends only body as the notification message |
2 | Sends only metadata. Invisible to user but will be received in push callback |
3 | Sends both metadata and body. Body is visible to the user. Push callback will receive <metadata>;<body>. |
4 | Sends both title and body. Push callback will receive <title>;<body> |
100 | Sends only the badge |
101 | Sends the badge and body. Push callback will receive the body only. |
102 | Sends 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.
type
- The type of the push notification.public boolean isRichPush()
public int getType()
isRichPush()
is true. Otherwise
it will return the underlying type as set with type(int)
.type(int)
,
isRichPush()