AndroidNotification.Builder

public static class AndroidNotification.Builder extends Object

Public Method Summary

AndroidNotification.Builder
addAllBodyLocalizationArgs(List<String> args)
Adds a list of resource keys that will be used in place of the format specifiers in bodyLocKey.
AndroidNotification.Builder
addAllTitleLocalizationArgs(List<String> args)
Adds a list of resource keys that will be used in place of the format specifiers in titleLocKey.
AndroidNotification.Builder
addBodyLocalizationArg(String arg)
Adds a resource key string that will be used in place of the format specifiers in bodyLocKey.
AndroidNotification.Builder
addTitleLocalizationArg(String arg)
Adds a resource key string that will be used in place of the format specifiers in titleLocKey.
AndroidNotification
build()
Creates a new AndroidNotification instance from the parameters set on this builder.
AndroidNotification.Builder
setBody(String body)
Sets the body of the Android notification.
AndroidNotification.Builder
setBodyLocalizationKey(String bodyLocKey)
Sets the key of the body string in the app's string resources to use to localize the body text.
AndroidNotification.Builder
setClickAction(String clickAction)
Sets the action associated with a user click on the notification.
AndroidNotification.Builder
setColor(String color)
Sets the notification icon color.
AndroidNotification.Builder
setIcon(String icon)
Sets the icon of the Android notification.
AndroidNotification.Builder
setSound(String sound)
Sets the sound to be played when the device receives the notification.
AndroidNotification.Builder
setTag(String tag)
Sets the notification tag.
AndroidNotification.Builder
setTitle(String title)
Sets the title of the Android notification.
AndroidNotification.Builder
setTitleLocalizationKey(String titleLocKey)
Sets the key of the title string in the app's string resources to use to localize the title text.

Inherited Method Summary

Public Methods

public AndroidNotification.Builder addAllBodyLocalizationArgs (List<String> args)

Adds a list of resource keys that will be used in place of the format specifiers in bodyLocKey.

Parameters
args List of resource key strings.
Returns
  • This builder.

public AndroidNotification.Builder addAllTitleLocalizationArgs (List<String> args)

Adds a list of resource keys that will be used in place of the format specifiers in titleLocKey.

Parameters
args List of resource key strings.
Returns
  • This builder.

public AndroidNotification.Builder addBodyLocalizationArg (String arg)

Adds a resource key string that will be used in place of the format specifiers in bodyLocKey.

Parameters
arg Resource key string.
Returns
  • This builder.

public AndroidNotification.Builder addTitleLocalizationArg (String arg)

Adds a resource key string that will be used in place of the format specifiers in titleLocKey.

Parameters
arg Resource key string.
Returns
  • This builder.

public AndroidNotification build ()

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

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

public AndroidNotification.Builder setBody (String body)

Sets the body of the Android notification. When provided, overrides the body sent via Notification.

Parameters
body Body of the notification.
Returns
  • This builder.

public AndroidNotification.Builder setBodyLocalizationKey (String bodyLocKey)

Sets the key of the body string in the app's string resources to use to localize the body text.

Parameters
bodyLocKey Resource key string.
Returns
  • This builder.

public AndroidNotification.Builder setClickAction (String clickAction)

Sets the action associated with a user click on the notification. If specified, an activity with a matching Intent Filter is launched when a user clicks on the notification.

Parameters
clickAction Click action name.
Returns
  • This builder.

public AndroidNotification.Builder setColor (String color)

Sets the notification icon color.

Parameters
color Color specified in the #rrggbb format.
Returns
  • This builder.

public AndroidNotification.Builder setIcon (String icon)

Sets the icon of the Android notification.

Parameters
icon Icon resource for the notification.
Returns
  • This builder.

public AndroidNotification.Builder setSound (String sound)

Sets the sound to be played when the device receives the notification.

Parameters
sound File name of the sound resource or "default".
Returns
  • This builder.

public AndroidNotification.Builder setTag (String tag)

Sets the notification tag. This is an identifier used to replace existing notifications in the notification drawer. If not specified, each request creates a new notification.

Parameters
tag Notification tag.
Returns
  • This builder.

public AndroidNotification.Builder setTitle (String title)

Sets the title of the Android notification. When provided, overrides the title set via Notification.

Parameters
title Title of the notification.
Returns
  • This builder.

public AndroidNotification.Builder setTitleLocalizationKey (String titleLocKey)

Sets the key of the title string in the app's string resources to use to localize the title text.

Parameters
titleLocKey Resource key string.
Returns
  • This builder.

Send feedback about...

Need help? Visit our support page.