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(constNotification & other)
Copy constructor. Makes a deep copy of thisMessage.
~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=(constNotification & other)
Copy assignment operator. Makes a deep copy of thisMessage.

Public attributes

android

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

Parameters that are unique to the Android implementation.

badge

std::stringfirebase::messaging::Notification::badge

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

body

std::stringfirebase::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, seeFormatting strings.

body_loc_key

std::stringfirebase::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::stringfirebase::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::stringfirebase::messaging::Notification::color

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

icon

std::stringfirebase::messaging::Notification::icon

Indicates notification icon.

Sets value to myicon for drawable resource myicon.

sound

std::stringfirebase::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::stringfirebase::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::stringfirebase::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, seeFormatting strings.

title_loc_key

std::stringfirebase::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(constNotification&other)

Copy constructor. Makes a deep copy of thisMessage.

operator=

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

Copy assignment operator. Makes a deep copy of thisMessage.

~Notification

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

Destructor.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.