Public Method Summary
AndroidConfig |
build()
Creates a new
AndroidConfig instance from the parameters set on this builder. |
AndroidConfig.Builder |
putAllData(Map<String, String> map)
Adds all the key-value pairs in the given map to the message as data fields.
|
AndroidConfig.Builder |
putData(String key, String value)
Adds the given key-value pair to the message as a data field.
|
AndroidConfig.Builder |
setCollapseKey(String collapseKey)
Sets a collapse key for the message.
|
AndroidConfig.Builder |
setDirectBootOk(boolean directBootOk)
Sets the
direct_boot_ok flag. |
AndroidConfig.Builder |
setFcmOptions(AndroidFcmOptions androidFcmOptions)
Sets the
AndroidFcmOptions , which overrides values set in the FcmOptions
for Android messages. |
AndroidConfig.Builder |
setNotification(AndroidNotification notification)
Sets the Android notification to be included in the message.
|
AndroidConfig.Builder | |
AndroidConfig.Builder |
setRestrictedPackageName(String restrictedPackageName)
Sets the package name of the application where the registration tokens must match in order
to receive the message.
|
AndroidConfig.Builder |
setTtl(long ttl)
Sets the time-to-live duration of the message in milliseconds.
|
Inherited Method Summary
Public Methods
public AndroidConfig build ()
Creates a new AndroidConfig
instance from the parameters set on this builder.
Returns
- A new
AndroidConfig
instance.
Throws
IllegalArgumentException | If any of the parameters set on the builder are invalid. |
---|
public AndroidConfig.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 and values may be null. When set, overrides any data fields set on the top-level
Message
via putData(String, String)
and
putAllData(Map)
.
Parameters
map | A non-null map of data fields. Map must not contain null keys or values. |
---|
Returns
- This builder.
public AndroidConfig.Builder putData (String key, String value)
Adds the given key-value pair to the message as a data field. Key and the value may not be
null. When set, overrides any data fields set on the top-level Message
via
putData(String, String)
and putAllData(Map)
.
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 AndroidConfig.Builder setCollapseKey (String collapseKey)
Sets a collapse key for the message. The collapse key serves as an identifier for a group of messages that can be collapsed, so that only the last message gets sent when delivery can be resumed. A maximum of 4 different collapse keys may be active at any given time.
By default, the collapse key is the app package name registered in the Firebase console.
Parameters
collapseKey | A collapse key string. |
---|
Returns
- This builder.
public AndroidConfig.Builder setDirectBootOk (boolean directBootOk)
Sets the direct_boot_ok
flag. If set to true, messages are delivered to
the app while the device is in direct boot mode.
public AndroidConfig.Builder setFcmOptions (AndroidFcmOptions androidFcmOptions)
Sets the AndroidFcmOptions
, which overrides values set in the FcmOptions
for Android messages.
public AndroidConfig.Builder setNotification (AndroidNotification notification)
Sets the Android notification to be included in the message.
Parameters
notification | An AndroidNotification instance. |
---|
Returns
- This builder.
public AndroidConfig.Builder setPriority (AndroidConfig.Priority priority)
Sets the priority of the message.
Parameters
priority | A value from the AndroidConfig.Priority enum. |
---|
Returns
- This builder.
public AndroidConfig.Builder setRestrictedPackageName (String restrictedPackageName)
Sets the package name of the application where the registration tokens must match in order to receive the message.
Parameters
restrictedPackageName | A package name string. |
---|
Returns
- This builder.
public AndroidConfig.Builder setTtl (long ttl)
Sets the time-to-live duration of the message in milliseconds.
Parameters
ttl | Time-to-live duration in milliseconds. |
---|
Returns
- This builder.