public class MpnBuilder
extends java.lang.Object
MpnSubscription.setNotificationFormat(String)
.Constructor and Description |
---|
MpnBuilder()
Creates an empty object to be used to create a push notification format from scratch.
Use setters methods to set the value of push notification fields. |
MpnBuilder(java.lang.String notificationFormat)
Creates an object based on the specified push notification format.
Use getter methods to obtain the value of push notification fields. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
body()
Gets the value of
android.notification.body field. |
MpnBuilder |
body(java.lang.String body)
Sets the
android.notification.body field. |
java.util.List<java.lang.String> |
bodyLocArguments()
Gets the value of
android.notification.body_loc_args field. |
MpnBuilder |
bodyLocArguments(java.util.List<java.lang.String> bodyLocArguments)
Sets the
android.notification.body_loc_args field. |
java.lang.String |
bodyLocKey()
Gets the value of
android.notification.body_loc_key field. |
MpnBuilder |
bodyLocKey(java.lang.String bodyLocKey)
Sets the
android.notification.body_loc_key field. |
java.lang.String |
build()
Produces the JSON structure for the push notification format specified by this object.
|
java.lang.String |
clickAction()
Gets the value of
android.notification.click_action field. |
MpnBuilder |
clickAction(java.lang.String clickAction)
Sets the
android.notification.click_action field. |
java.lang.String |
collapseKey()
Gets the value of
android.collapse_key field. |
MpnBuilder |
collapseKey(java.lang.String collapseKey)
Sets the
android.collapse_key field. |
java.lang.String |
color()
Gets the value of
android.notification.color field. |
MpnBuilder |
color(java.lang.String color)
Sets the
android.notification.color field. |
MpnBuilder |
contentAvailable(java.lang.Boolean contentAvailable)
Deprecated.
The
content_available is no more supported on Firebase Cloud Messaging. |
MpnBuilder |
contentAvailable(java.lang.String contentAvailable)
Deprecated.
The
content_available is no more supported on Firebase Cloud Messaging. |
java.lang.Boolean |
contentAvailableAsBoolean()
Deprecated.
The
content_available is no more supported on Firebase Cloud Messaging. |
java.lang.String |
contentAvailableAsString()
Deprecated.
The
content_available is no more supported on Firebase Cloud Messaging. |
java.util.Map<java.lang.String,java.lang.String> |
data()
Gets sub-fields of the
android.data field. |
MpnBuilder |
data(java.util.Map<java.lang.String,java.lang.String> data)
Sets sub-fields of the
android.data field. |
java.lang.String |
icon()
Gets the value of
android.notification.icon field. |
MpnBuilder |
icon(java.lang.String icon)
Sets the
android.notification.icon field. |
java.lang.String |
priority()
Gets the value of
android.priority field. |
MpnBuilder |
priority(java.lang.String priority)
Sets the
android.priority field. |
java.lang.String |
sound()
Gets the value of
android.notification.sound field. |
MpnBuilder |
sound(java.lang.String sound)
Sets the
android.notification.sound field. |
java.lang.String |
tag()
Gets the value of
android.notification.tag field. |
MpnBuilder |
tag(java.lang.String tag)
Sets the
android.notification.tag field. |
MpnBuilder |
timeToLive(java.lang.Integer timeToLive)
Sets the
android.ttl field with an integer value. |
MpnBuilder |
timeToLive(java.lang.String timeToLive)
Sets the
android.ttl field with a string value. |
java.lang.Integer |
timeToLiveAsInteger()
Gets the value of
android.ttl field as an integer. |
java.lang.String |
timeToLiveAsString()
Gets the value of
android.ttl field as a string. |
java.lang.String |
title()
Gets the value of
android.notification.title field. |
MpnBuilder |
title(java.lang.String title)
Sets the
android.notification.title field. |
java.util.List<java.lang.String> |
titleLocArguments()
Gets the value of
android.notification.title_loc_args field. |
MpnBuilder |
titleLocArguments(java.util.List<java.lang.String> titleLocArguments)
Sets the
android.notification.title_loc_args field. |
java.lang.String |
titleLocKey()
Gets the value of
android.notification.title_loc_key field. |
MpnBuilder |
titleLocKey(java.lang.String titleLocKey)
Sets the
android.notification.title_loc_key field. |
public MpnBuilder()
public MpnBuilder(@Nonnull java.lang.String notificationFormat)
notificationFormat
- A JSON structure representing a push notification format.java.lang.IllegalArgumentException
- if the notification is not a valid JSON structure.@Nonnull public java.lang.String build()
public MpnBuilder collapseKey(java.lang.String collapseKey)
android.collapse_key
field.collapseKey
- A string to be used for the android.collapse_key
field value, or null to clear it.public java.lang.String collapseKey()
android.collapse_key
field.android.collapse_key
field, or null if absent.public MpnBuilder priority(java.lang.String priority)
android.priority
field.priority
- A string to be used for the android.priority
field value, or null to clear it.public java.lang.String priority()
android.priority
field.android.priority
field, or null if absent.@Deprecated public MpnBuilder contentAvailable(java.lang.String contentAvailable)
content_available
is no more supported on Firebase Cloud Messaging.contentAvailable
- Ignored.@Deprecated public java.lang.String contentAvailableAsString()
content_available
is no more supported on Firebase Cloud Messaging.@Deprecated public MpnBuilder contentAvailable(java.lang.Boolean contentAvailable)
content_available
is no more supported on Firebase Cloud Messaging.contentAvailable
- Ignored.@Deprecated public java.lang.Boolean contentAvailableAsBoolean()
content_available
is no more supported on Firebase Cloud Messaging.public MpnBuilder timeToLive(java.lang.String timeToLive)
android.ttl
field with a string value.timeToLive
- A string to be used for the android.ttl
field value, or null to clear it.public java.lang.String timeToLiveAsString()
android.ttl
field as a string.android.ttl
field, or null if absent.public MpnBuilder timeToLive(java.lang.Integer timeToLive)
android.ttl
field with an integer value.timeToLive
- An integer to be used for the android.ttl
field value, or null to clear it.public java.lang.Integer timeToLiveAsInteger()
android.ttl
field as an integer.android.ttl
field, or null if absent.public MpnBuilder title(java.lang.String title)
android.notification.title
field.title
- A string to be used for the android.notification.title
field value, or null to clear it.public java.lang.String title()
android.notification.title
field.android.notification.title
field, or null if absent.public MpnBuilder titleLocKey(java.lang.String titleLocKey)
android.notification.title_loc_key
field.titleLocKey
- A string to be used for the android.notification.title_loc_key
field value, or null to clear it.public java.lang.String titleLocKey()
android.notification.title_loc_key
field.android.notification.title_loc_key
field, or null if absent.public MpnBuilder titleLocArguments(java.util.List<java.lang.String> titleLocArguments)
android.notification.title_loc_args
field.titleLocArguments
- A list of strings to be used for the android.notification.title_loc_args
field value, or null to clear it.public java.util.List<java.lang.String> titleLocArguments()
android.notification.title_loc_args
field.android.notification.title_loc_args
field, or null if absent.public MpnBuilder body(java.lang.String body)
android.notification.body
field.body
- A string to be used for the android.notification.body
field value, or null to clear it.public java.lang.String body()
android.notification.body
field.android.notification.body
field, or null if absent.public MpnBuilder bodyLocKey(java.lang.String bodyLocKey)
android.notification.body_loc_key
field.bodyLocKey
- A string to be used for the android.notification.body_loc_key
field value, or null to clear it.public java.lang.String bodyLocKey()
android.notification.body_loc_key
field.android.notification.body_loc_key
field, or null if absent.public MpnBuilder bodyLocArguments(java.util.List<java.lang.String> bodyLocArguments)
android.notification.body_loc_args
field.bodyLocArguments
- A list of strings to be used for the android.notification.body_loc_args
field value, or null to clear it.public java.util.List<java.lang.String> bodyLocArguments()
android.notification.body_loc_args
field.android.notification.body_loc_args
field, or null if absent.public MpnBuilder icon(java.lang.String icon)
android.notification.icon
field.icon
- A string to be used for the android.notification.icon
field value, or null to clear it.public java.lang.String icon()
android.notification.icon
field.android.notification.icon
field, or null if absent.public MpnBuilder sound(java.lang.String sound)
android.notification.sound
field.sound
- A string to be used for the android.notification.sound
field value, or null to clear it.public java.lang.String sound()
android.notification.sound
field.android.notification.sound
field, or null if absent.public MpnBuilder tag(java.lang.String tag)
android.notification.tag
field.tag
- A string to be used for the android.notification.tag
field value, or null to clear it.public java.lang.String tag()
android.notification.tag
field.android.notification.tag
field, or null if absent.public MpnBuilder color(java.lang.String color)
android.notification.color
field.color
- A string to be used for the android.notification.color
field value, or null to clear it.public java.lang.String color()
android.notification.color
field.android.notification.color
field, or null if absent.public MpnBuilder clickAction(java.lang.String clickAction)
android.notification.click_action
field.clickAction
- A string to be used for the android.notification.click_action
field value, or null to clear it.public java.lang.String clickAction()
android.notification.click_action
field.android.notification.click_action
field, or null if absent.public MpnBuilder data(java.util.Map<java.lang.String,java.lang.String> data)
android.data
field.data
- A map to be used for sub-fields of the android.data
field, or null to clear it.public java.util.Map<java.lang.String,java.lang.String> data()
android.data
field.android.data
field, or null if absent.