firebase::messaging::Notification

#include <messaging.h>

Used for messages that display a notification.

Summary

On android, this requires that the app is using the Play Services client library.

Constructors and Destructors

Notification()
Notification(const Notification & other)
Copy constructor. Makes a deep copy of this Message.
~Notification()
Destructor.

Public attributes

android
Parameters that are unique to the Android implementation.
badge
std::string
Indicates the badge on the client app home icon. iOS and tvOS only.
body
std::string
Indicates notification body text.
body_loc_args
std::vector< std::string >
Indicates the string value to replace format specifiers in body string for localization.
body_loc_key
std::string
Indicates the key to the body string for localization.
click_action
std::string
The action associated with a user click on the notification.
color
std::string
Indicates color of the icon, expressed in #rrggbb format. Android only.
icon
std::string
Indicates notification icon.
sound
std::string
Indicates a sound to play when the device receives the notification.
tag
std::string
Indicates whether each notification results in a new entry in the notification drawer on Android.
title
std::string
Indicates notification title.
title_loc_args
std::vector< std::string >
Indicates the string value to replace format specifiers in title string for localization.
title_loc_key
std::string
Indicates the key to the title string for localization.

Public functions

operator=(const Notification & other)
Copy assignment operator. Makes a deep copy of this Message.

Public attributes

android

AndroidNotificationParams * firebase::messaging::Notification::android

Parameters that are unique to the Android implementation.

badge

std::string firebase::messaging::Notification::badge

Indicates the badge on the client app home icon. iOS and tvOS only.

body

std::string firebase::messaging::Notification::body

Indicates notification body text.

body_loc_args

std::vector< std::string > firebase::messaging::Notification::body_loc_args

Indicates the string value to replace format specifiers in body string for localization.

On iOS and tvOS, this corresponds to "loc-args" in APNS payload.

On Android, these are the format arguments for the string resource. For more information, see Formatting strings.

body_loc_key

std::string firebase::messaging::Notification::body_loc_key

Indicates the key to the body string for localization.

On iOS and tvOS, this corresponds to "loc-key" in APNS payload.

On Android, use the key in the app's string resources when populating this value.

click_action

std::string firebase::messaging::Notification::click_action

The action associated with a user click on the notification.

On Android, if this is set, an activity with a matching intent filter is launched when user clicks the notification.

If set on iOS or tvOS, corresponds to category in APNS payload.

color

std::string firebase::messaging::Notification::color

Indicates color of the icon, expressed in #rrggbb format. Android only.

icon

std::string firebase::messaging::Notification::icon

Indicates notification icon.

Sets value to myicon for drawable resource myicon.

sound

std::string firebase::messaging::Notification::sound

Indicates a sound to play when the device receives the notification.

Supports default, or the filename of a sound resource bundled in the app.

Android sound files must reside in /res/raw/, while iOS and tvOS sound files can be in the main bundle of the client app or in the Library/Sounds folder of the app’s data container.

tag

std::string firebase::messaging::Notification::tag

Indicates whether each notification results in a new entry in the notification drawer on Android.

If not set, each request creates a new notification. If set, and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.

title

std::string firebase::messaging::Notification::title

Indicates notification title.

This field is not visible on tvOS, iOS phones and tablets.

title_loc_args

std::vector< std::string > firebase::messaging::Notification::title_loc_args

Indicates the string value to replace format specifiers in title string for localization.

On iOS and tvOS, this corresponds to "title-loc-args" in APNS payload.

On Android, these are the format arguments for the string resource. For more information, see Formatting strings.

title_loc_key

std::string firebase::messaging::Notification::title_loc_key

Indicates the key to the title string for localization.

On iOS and tvOS, this corresponds to "title-loc-key" in APNS payload.

On Android, use the key in the app's string resources when populating this value.

Public functions

Notification

 firebase::messaging::Notification::Notification()

Notification

 firebase::messaging::Notification::Notification(
  const Notification & other
)

Copy constructor. Makes a deep copy of this Message.

operator=

Notification & firebase::messaging::Notification::operator=(
  const Notification & other
)

Copy assignment operator. Makes a deep copy of this Message.

~Notification

 firebase::messaging::Notification::~Notification()

Destructor.