Class PushBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbadge(int badge) Sets the badge to set with the push notification.Sets the body of the push notification.build()Builds the payload for this rich push notification.Sets the category of the push notification.intgetType()Gets the type of the notification.Sets the URL for an image to send in the push notification.booleanA notification is considered to be a rich push notification if either#imageUrlor#categoryis set.Sets the metadata (i.e. content the user shouldn't see) for the push notification.Sets the title of the push notification.type(int type) Sets the type of the push notification.
-
Constructor Details
-
PushBuilder
public PushBuilder()
-
-
Method Details
-
title
Sets the title of the push notification.
Parameters
title: The title of the push notification.
Returns
Self for chaining.
-
badge
Sets the badge to set with the push notification.
Parameters
badge: The badge to set.
Returns
Self for chaining.
-
body
Sets the body of the push notification.
Parameters
body: The body of the push notification.
Returns
Self for chaining.
-
metaData
Sets the metadata (i.e. content the user shouldn't see) for the push notification.
Parameters
metaData: The metadata.
Returns
Self for chaining.
-
imageUrl
Sets the URL for an image to send in the push notification. Make sure you use https:// or the image won't be shown on iOS.
Parameters
imageUrl: The image URL.
Returns
Self for chaining.
-
category
Sets the category of the push notification.
Parameters
category: The category.
Returns
Self for chaining.
-
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
;. 4Sends both title and body. Push callback will receive ; 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; Both
#imageUrland#categorycan 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
type: The type of the push notification.
Returns
Self for chaining.
-
isRichPush
public boolean isRichPush()A notification is considered to be a rich push notification if either
#imageUrlor#categoryis set.Returns
True if the notification is a rich notification.
-
getType
public int getType()Gets the type of the notification. This will return 99 if
#isRichPush()is true. Otherwise it will return the underlying type as set with#type(int).Returns
The type of the notification.
See also
-
#type(int)
-
#isRichPush()
-
-
build
Builds the payload for this rich push notification.
Returns
The payload that can be passed as the message body to
Push
-