| CLASS info |
| public static class RemoteMessage.Notification implements Serializable |
| The RemoteMessage.Notification class is an internal class that indicates notification messages. When an app server sends a notification message, if the developer has configured the function on the server's open API that if the app is running in the foreground, the notification message is not displayed in the Notification Center (NC) but transparently transmitted to the app, the message is processed for display by the app. In this case, the RemoteMessage.Notification instance is contained in the RemoteMessage instance. The member fields defined in the Notification class map the fields defined in the AndroidNotification structure in Sending Messages. For apps running in the background or that do not exist, notification messages are displayed in the NC. |
| Return type | Method name |
| String | getTitle() |
| String | getTitleLocalizationKey() |
| String[] | getTitleLocalizationArgs() |
| String | getBodyLocalizationKey() |
| String[] | getBodyLocalizationArgs() |
| String | getBody() |
| String | getIcon() |
| String | getSound() |
| String | getTag() |
| String | getColor() |
| String | getClickAction() |
| String | getChannelId() |
| Uri | getImageUrl() |
| Uri | getLink() |
| int | getNotifyId() |
| boolean | isDefaultLight() |
| boolean | isDefaultSound() |
| boolean | isDefaultVibrate() |
| long | getWhen() |
| int[] | getLightSettings() |
| Integer | getBadgeNumber() |
| boolean | isAutoCancel() |
| Integer | getImportance() |
| String | getTicker() |
| long[] | getVibrateConfig() |
| int | getVisibility() |
| String | getIntentUri() |
| Method |
| public String getTitle() |
| This method is used to obtain the title of a message. |
| Method |
| public String[] getTitleLocalizationArgs() |
This method is used to obtain variable string values in the localized title of a notification message. It must be used together with the getTitleLocalizationKey method. The key obtained by the getTitleLocalizationKey() method must be the same as the node name in the strings.xml file of the app, and the number of variable string values obtained by the getTitleLocalizationArgs method cannot be smaller than the number of placeholders in the value mapping the key in the strings.xml file. For details, please refer to Notification Message Localization in the development guide. Example: getTitleLocalizationKey: "demo_title_new" getTitleLocalizationArgs: ["apple", "orange"] Configuration in the strings.xml file:
|
| Method |
| public String[] getBodyLocalizationArgs() |
| This method is used to obtain variable string values in the localized content of a message. It must be used together with the getBodyLocalizationKey method. The key obtained by the getBodyLocalizationKey() method must be the same as the node name in the strings.xml file of the app, and the number of variable string values obtained by the getBodyLocalizationArgs method cannot be smaller than the number of placeholders in the value mapping the key in the strings.xml file. For details, please refer to Notification Message Localization in the development guide. |
| Method |
| public String getBody() |
| This method is used to obtain the displayed content of a message. |
| Method |
| public String getIcon() |
| This method is used to obtain the image resource name of a notification icon. On an Android device, all icon files are stored in the /res/raw/** directory of the app. |
Return
| type | desc |
| String | Icon resource file name, for example, /raw/ic_launcher, corresponding to the local file /res/raw/ic_launcher.png. |
Return
| type | desc |
| String | Audio resource file name, for example, /raw/shake, corresponding to the local file /res/raw/shake.mp3. |
| Method |
| public String getTag() |
| This method is used to obtain the tag from a message for message overwriting. A message will be overwritten by another message with the same tag but is sent later. |
Return
| type | desc |
| String | Message tag. |
| Method |
| public String getColor() |
| This method is used to obtain the colors (in #RRGGBB format) of icons in a message. |
Return
| type | desc |
| String | Colors of icons in a message. |
| Method |
| public String getClickAction() |
| This method is used to obtain the action triggered upon notification message tapping. If no action is specified, null is returned. For the definition of actions, please refer to the definition in the ClickAction structure in Sending Messages of the development guide. |
Return
| type | desc |
| String | Action triggered upon notification message tapping. The action returned must be the same as the action declared in the intent-filter tag of Activity defined in AndroidManifest.xml. |
| Method |
| public String getChannelId() |
| This method is used to obtain IDs of channels that support the display of a message. If no channel is set, null is returned. |
Return
| type | desc |
| String | IDs of channels configured locally. |
| Method |
| public Uri getImageUrl() |
| This method is used to obtain the URL of an image in a message. The image URL must be a URL that can be accessed from the public network. |
Return
| type | desc |
| Uri | Image URL set by the developer. If no URL is set, null is returned. |
| Method |
| public Uri getLink() |
| This method is used to obtain the deep link from a message. A deep link is a specific URL, such as the URL of a web page or rich media. If no URL is set, null is returned. |
Return
| type | desc |
| Uri | URL in a message. |
| Method |
| public int getNotifyId() |
| This method is used to obtain the unique ID of a message. Different messages can have the same value of NotifyId, so that new messages can overwrite old messages. |
Return
| type | desc |
| int | Unique ID of a message. |
| Method |
| public boolean isDefaultLight() |
| This method is used to check whether a notification message uses the default notification light settings. For details, please refer to the description of use_default_light in the AndroidNotification structure in Sending Messages. |
Return
| type | desc |
| boolean | Value true or false. |
| Method |
| public boolean isDefaultSound() |
| This method is used to check whether a notification message uses the default sound. For details, please refer to the description of default_sound in the AndroidNotification structure in Sending Messages. |
Return
| type | desc |
| boolean | Value true or false. |
| Method |
| public boolean isDefaultVibrate() |
| This method is used to check whether a notification message uses the default vibration mode. For details, please refer to the description of use_default_vibrate in the AndroidNotification structure in Sending Messages. |
Return
| type | desc |
| boolean | Value true or false. |
| Method |
| public long getWhen() |
| This method is used to obtain the time (in milliseconds) when an event occurs from a notification message. Developers can sort notification messages by this time. |
| Method |
| public int[] getLightSettings() |
| This method is used to obtain the blinking frequency and color of a breathing light. For details, please refer to the description of light_settings in the AndroidNotification structure in Sending Messages. |
| Method |
| public Integer getBadgeNumber() |
| This method is used to obtain the number of notification messages. |
Return
| type | desc |
| boolean | Value true or false. |
| Method |
| public Integer getImportance() |
| This method is used to obtain the priority of a notification message. |
| Method |
| public String getTicker() |
| This method is used to obtain the text to be displayed on the status bar for a notification message. |
| Method |
| public long[] getVibrateConfig() |
| This method is used to obtain the vibration mode of a message. For details, please refer to the description of vibrate_config in the AndroidNotification structure in Sending Messages. |
Return
| type | desc |
| long[] | Array consisting of at most 10 elements, with each in milliseconds. |
| Method |
| public int getVisibility() |
| This method is used to obtain the visibility of a notification message. For details, please refer to the definition of visibility in the AndroidNotification structure. |
| Method |
| public String getIntentUri() |
| This method is used to obtain the intent in a notification message. The intent can be opening a page specified by the app. For details, please refer to the definition of the intent parameter in the ClickAction structure in Sending Messages of the development guide. |