Message.Builder

public static class Message.Builder extends Object

Public Method Summary

Message
build()
Creates a new Message instance from the parameters set on this builder.
Message.Builder
putAllData(Map<String, String> map)
Adds all the key-value pairs in the given map to the message as data fields.
Message.Builder
putData(String key, String value)
Adds the given key-value pair to the message as a data field.
Message.Builder
setAndroidConfig(AndroidConfig androidConfig)
Sets the Android-specific information to be included in the message.
Message.Builder
setApnsConfig(ApnsConfig apnsConfig)
Sets the information specific to APNS (Apple Push Notification Service).
Message.Builder
setCondition(String condition)
Sets the FCM condition to which the message should be sent.
Message.Builder
setNotification(Notification notification)
Sets the notification information to be included in the message.
Message.Builder
setToken(String token)
Sets the registration token of the device to which the message should be sent.
Message.Builder
setTopic(String topic)
Sets the name of the FCM topic to which the message should be sent.
Message.Builder
setWebpushConfig(WebpushConfig webpushConfig)
Sets the Webpush-specific information to be included in the message.

Inherited Method Summary

Public Methods

public Message build ()

Creates a new Message instance from the parameters set on this builder.

Returns
Throws
IllegalArgumentException If any of the parameters set on the builder are invalid.

public Message.Builder putAllData (Map<String, String> map)

Adds all the key-value pairs in the given map to the message as data fields. None of the keys or values may be null.

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

public Message.Builder putData (String key, String value)

Adds the given key-value pair to the message as a data field. Key or the value may not be null.

Parameters
key Name of the data field. Must not be null.
value Value of the data field. Must not be null.
Returns
  • This builder.

public Message.Builder setAndroidConfig (AndroidConfig androidConfig)

Sets the Android-specific information to be included in the message.

Parameters
androidConfig An AndroidConfig instance.
Returns
  • This builder.

public Message.Builder setApnsConfig (ApnsConfig apnsConfig)

Sets the information specific to APNS (Apple Push Notification Service).

Parameters
apnsConfig An ApnsConfig instance.
Returns
  • This builder.

public Message.Builder setCondition (String condition)

Sets the FCM condition to which the message should be sent.

Parameters
condition A valid condition string (e.g. "'foo' in topics").
Returns
  • This builder.

public Message.Builder setNotification (Notification notification)

Sets the notification information to be included in the message.

Parameters
notification A Notification instance.
Returns
  • This builder.

public Message.Builder setToken (String token)

Sets the registration token of the device to which the message should be sent.

Parameters
token A valid device registration token.
Returns
  • This builder.

public Message.Builder setTopic (String topic)

Sets the name of the FCM topic to which the message should be sent. Topic names may contain the /topics/ prefix.

Parameters
topic A valid topic name.
Returns
  • This builder.

public Message.Builder setWebpushConfig (WebpushConfig webpushConfig)

Sets the Webpush-specific information to be included in the message.

Parameters
webpushConfig A WebpushConfig instance.
Returns
  • This builder.

Send feedback about...

Need help? Visit our support page.