WebpushNotification.Builder

public static class WebpushNotification.Builder extends Object

Public Method Summary

WebpushNotification.Builder
addAction(WebpushNotification.Action action)
Adds a notification action to the notification.
WebpushNotification.Builder
addAllActions(List<WebpushNotification.Action> actions)
Adds all the actions in the given list to the notification.
WebpushNotification
build()
Creates a new WebpushNotification from the parameters set on this builder.
WebpushNotification.Builder
putAllCustomData(Map<String, Object> fields)
Puts all the key-value pairs in the specified map to the notification.
WebpushNotification.Builder
putCustomData(String key, Object value)
Puts a custom key-value pair to the notification.
WebpushNotification.Builder
setBadge(String badge)
Sets the URL of the image used to represent the notification when there is not enough space to display the notification itself.
WebpushNotification.Builder
setBody(String body)
Sets the body text of the notification.
WebpushNotification.Builder
setData(Object data)
Sets any arbitrary data that should be associated with the notification.
WebpushNotification.Builder
setDirection(WebpushNotification.Direction direction)
Sets the direction in which to display the notification.
WebpushNotification.Builder
setIcon(String icon)
Sets the URL to the icon of the notification.
WebpushNotification.Builder
setImage(String image)
Sets the URL of an image to be displayed in the notification.
WebpushNotification.Builder
setLanguage(String language)
Sets the language of the notification.
WebpushNotification.Builder
setRenotify(boolean renotify)
Sets whether the user should be notified after a new notification replaces an old one.
WebpushNotification.Builder
setRequireInteraction(boolean requireInteraction)
Sets whether a notification should remain active until the user clicks or dismisses it, rather than closing automatically.
WebpushNotification.Builder
setSilent(boolean silent)
Sets whether the notification should be silent.
WebpushNotification.Builder
setTag(String tag)
Sets an identifying tag on the notification.
WebpushNotification.Builder
setTimestampMillis(long timestampMillis)
Sets a timestamp value in milliseconds on the notification.
WebpushNotification.Builder
setTitle(String title)
Sets the title text of the notification.
WebpushNotification.Builder
setVibrate(int[] pattern)
Sets a vibration pattern for the device's vibration hardware to emit when the notification fires.

Inherited Method Summary

Public Methods

public WebpushNotification.BuilderaddAction(WebpushNotification.Action action)

Adds a notification action to the notification.

Parameters
actionA non-null WebpushNotification.Action.
Returns
  • This builder.

public WebpushNotification.BuilderaddAllActions(List<WebpushNotification.Action> actions)

Adds all the actions in the given list to the notification.

Parameters
actionsA non-null list of actions.
Returns
  • This builder.

public WebpushNotificationbuild()

Creates a new WebpushNotification from the parameters set on this builder.

Returns

public WebpushNotification.BuilderputAllCustomData(Map<String, Object> fields)

Puts all the key-value pairs in the specified map to the notification.

Parameters
fieldsA non-null map. Map must not contain null keys or values.
Returns
  • This builder.

public WebpushNotification.BuilderputCustomData(String key, Object value)

Puts a custom key-value pair to the notification.

Parameters
keyA non-null key.
valueA non-null, json-serializable value.
Returns
  • This builder.

public WebpushNotification.BuildersetBadge(String badge)

Sets the URL of the image used to represent the notification when there is not enough space to display the notification itself.

Parameters
badgeBadge URL.
Returns
  • This builder.

public WebpushNotification.BuildersetBody(String body)

Sets the body text of the notification.

Parameters
bodyBody text.
Returns
  • This builder.

public WebpushNotification.BuildersetData(Object data)

Sets any arbitrary data that should be associated with the notification.

Parameters
dataA JSON-serializable object.
Returns
  • This builder.

public WebpushNotification.BuildersetDirection(WebpushNotification.Direction direction)

Sets the direction in which to display the notification.

Parameters
directionDirection enum value.
Returns
  • This builder.

public WebpushNotification.BuildersetIcon(String icon)

Sets the URL to the icon of the notification.

Parameters
iconIcon URL.
Returns
  • This builder.

public WebpushNotification.BuildersetImage(String image)

Sets the URL of an image to be displayed in the notification.

Parameters
imageImage URL
Returns
  • This builder.

public WebpushNotification.BuildersetLanguage(String language)

Sets the language of the notification.

Parameters
languageNotification language.
Returns
  • This builder.

public WebpushNotification.BuildersetRenotify(boolean renotify)

Sets whether the user should be notified after a new notification replaces an old one.

Parameters
renotifytrue to notify the user on replacement.
Returns
  • This builder.

public WebpushNotification.BuildersetRequireInteraction(boolean requireInteraction)

Sets whether a notification should remain active until the user clicks or dismisses it, rather than closing automatically.

Parameters
requireInteractiontrue to keep the notification active until user interaction.
Returns
  • This builder.

public WebpushNotification.BuildersetSilent(boolean silent)

Sets whether the notification should be silent.

Parameters
silenttrue to indicate that the notification should be silent.
Returns
  • This builder.

public WebpushNotification.BuildersetTag(String tag)

Sets an identifying tag on the notification.

Parameters
tagA tag to be associated with the notification.
Returns
  • This builder.

public WebpushNotification.BuildersetTimestampMillis(long timestampMillis)

Sets a timestamp value in milliseconds on the notification.

Parameters
timestampMillisA timestamp value as a number.
Returns
  • This builder.

public WebpushNotification.BuildersetTitle(String title)

Sets the title text of the notification.

Parameters
titleTitle text.
Returns
  • This builder.

public WebpushNotification.BuildersetVibrate(int[] pattern)

Sets a vibration pattern for the device's vibration hardware to emit when the notification fires.

Parameters
patternAn integer array representing a vibration pattern.
Returns
  • This builder.