|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.notnoop.apns.PayloadBuilder
public final class PayloadBuilder
Represents a builder for constructing Payload requests, as specified by Apple Push Notification Programming Guide.
| Method Summary | |
|---|---|
PayloadBuilder |
actionKey(String actionKey)
Sets the value of action button (the right button to be displayed). |
PayloadBuilder |
alertBody(String alert)
Sets the alert body text, the text the appears to the user, to the passed value |
PayloadBuilder |
badge(int badge)
Sets the notification badge to be displayed next to the application icon. |
String |
build()
Returns the JSON String representation of the payload according to Apple APNS specification |
byte[] |
buildBytes()
Returns the bytes representation of the payload according to Apple APNS specification |
PayloadBuilder |
clearBadge()
Requests clearing of the badge number next to the application icon. |
PayloadBuilder |
copy()
Returns a copy of this builder |
PayloadBuilder |
customField(String key,
Object value)
Sets any application-specific custom fields. |
PayloadBuilder |
customFields(Map<String,? extends Object> values)
Set any application-specific custom fields. |
PayloadBuilder |
forNewsstand()
Sets the notification type to be a 'newstand' notification. |
boolean |
isTooLong()
Returns true if the payload built so far is larger than the size permitted by Apple (which is 256 bytes). |
PayloadBuilder |
launchImage(String launchImage)
Sets the launch image file for the push notification |
int |
length()
Returns the length of payload bytes once marshaled to bytes |
PayloadBuilder |
localizedArguments(Collection<String> arguments)
Sets the arguments for the alert message localizable message. |
PayloadBuilder |
localizedArguments(String... arguments)
Sets the arguments for the alert message localizable message. |
PayloadBuilder |
localizedKey(String key)
Set the notification localized key for the alert body message. |
PayloadBuilder |
mdm(String s)
|
static PayloadBuilder |
newPayload()
|
PayloadBuilder |
noActionButton()
Set the notification view to display an action button. |
PayloadBuilder |
resizeAlertBody(int payloadLength)
Shrinks the alert message body so that the resulting payload message fits within the passed expected payload length. |
PayloadBuilder |
resizeAlertBody(int payloadLength,
String postfix)
Shrinks the alert message body so that the resulting payload message fits within the passed expected payload length. |
PayloadBuilder |
shrinkBody()
Shrinks the alert message body so that the resulting payload message fits within require Apple specification (256 bytes). |
PayloadBuilder |
shrinkBody(String postfix)
Shrinks the alert message body so that the resulting payload message fits within require Apple specification (256 bytes). |
PayloadBuilder |
sound(String sound)
Sets the alert sound to be played. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public PayloadBuilder alertBody(String alert)
alert - the text to appear to the user
public PayloadBuilder sound(String sound)
null disables the notification sound.
sound - the file name or song name to be played
when receiving the notification
public PayloadBuilder badge(int badge)
badge - the badge number to be displayed
public PayloadBuilder clearBadge()
badge(0).
public PayloadBuilder actionKey(String actionKey)
null actionKey indicates no additional button
is displayed, just the Cancel button.
actionKey - the title of the additional button
public PayloadBuilder noActionButton()
actionKey(null)
public PayloadBuilder forNewsstand()
public PayloadBuilder localizedKey(String key)
key - the localizable message body key
public PayloadBuilder localizedArguments(Collection<String> arguments)
arguments - the arguments to the localized alert message
public PayloadBuilder localizedArguments(String... arguments)
arguments - the arguments to the localized alert message
public PayloadBuilder launchImage(String launchImage)
launchImage - the filename of the image file in the
application bundle.
public PayloadBuilder customField(String key,
Object value)
key - the custom field namevalue - the custom field value
public PayloadBuilder mdm(String s)
public PayloadBuilder customFields(Map<String,? extends Object> values)
map - the custom map
public int length()
public boolean isTooLong()
public PayloadBuilder resizeAlertBody(int payloadLength)
payloadLength - the expected max size of the payload
public PayloadBuilder resizeAlertBody(int payloadLength,
String postfix)
payloadLength - the expected max size of the payloadpostfix - for the truncated body, e.g. "..."
public PayloadBuilder shrinkBody()
public PayloadBuilder shrinkBody(String postfix)
postfix - for the truncated body, e.g. "..."
public String build()
public byte[] buildBytes()
public String toString()
toString in class Objectpublic PayloadBuilder copy()
public static PayloadBuilder newPayload()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||