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.Builder addAction (WebpushNotification.Action action)

Adds a notification action to the notification.

Parameters
action A non-null WebpushNotification.Action.
Returns
  • This builder.

public WebpushNotification.Builder addAllActions (List<WebpushNotification.Action> actions)

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

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

public WebpushNotification build ()

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

Returns

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

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

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

public WebpushNotification.Builder putCustomData (String key, Object value)

Puts a custom key-value pair to the notification.

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

public 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.

Parameters
badge Badge URL.
Returns
  • This builder.

public WebpushNotification.Builder setBody (String body)

Sets the body text of the notification.

Parameters
body Body text.
Returns
  • This builder.

public WebpushNotification.Builder setData (Object data)

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

Parameters
data A JSON-serializable object.
Returns
  • This builder.

public WebpushNotification.Builder setDirection (WebpushNotification.Direction direction)

Sets the direction in which to display the notification.

Parameters
direction Direction enum value.
Returns
  • This builder.

public WebpushNotification.Builder setIcon (String icon)

Sets the URL to the icon of the notification.

Parameters
icon Icon URL.
Returns
  • This builder.

public WebpushNotification.Builder setImage (String image)

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

Parameters
image Image URL
Returns
  • This builder.

public WebpushNotification.Builder setLanguage (String language)

Sets the language of the notification.

Parameters
language Notification language.
Returns
  • This builder.

public WebpushNotification.Builder setRenotify (boolean renotify)

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

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

public WebpushNotification.Builder setRequireInteraction (boolean requireInteraction)

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

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

public WebpushNotification.Builder setSilent (boolean silent)

Sets whether the notification should be silent.

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

public WebpushNotification.Builder setTag (String tag)

Sets an identifying tag on the notification.

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

public WebpushNotification.Builder setTimestampMillis (long timestampMillis)

Sets a timestamp value in milliseconds on the notification.

Parameters
timestampMillis A timestamp value as a number.
Returns
  • This builder.

public WebpushNotification.Builder setTitle (String title)

Sets the title text of the notification.

Parameters
title Title text.
Returns
  • This builder.

public WebpushNotification.Builder setVibrate (int[] pattern)

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

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