Class: Firebase::Admin::Messaging::AndroidNotification
- Inherits:
-
Object
- Object
- Firebase::Admin::Messaging::AndroidNotification
- Defined in:
- lib/firebase/admin/messaging/android_notification.rb
Overview
Android-specific notification options that can be included in an AndroidConfig.
Instance Attribute Summary collapse
-
#body ⇒ String?
Body of the Android notification.
-
#body_loc_args ⇒ Array<String>?
An array of resource keys that will be used in place of the format specifiers in #body_loc_key.
-
#body_loc_key ⇒ String?
Key of the body string in the app’s string resource to use to localize the body text.
-
#channel_id ⇒ String?
The Android notification channel id (new in Android O).
-
#click_action ⇒ String?
Action associated with a user click on the notification.
-
#color ⇒ String?
Notification icon color in ‘#rrggbb` format.
-
#default_light_settings ⇒ Boolean?
If set to ‘true`, use the Android framework’s default LED light settings for the notification.
-
#default_sound ⇒ Boolean?
If set to ‘true`, use the Android framework’s default sound for the notification.
-
#default_vibrate_timings ⇒ Boolean?
If set to ‘true`, use the Android framework’s default vibrate pattern for the notification.
-
#event_time ⇒ Time?
For notifications that inform users about events with an absolute time reference, sets the time that the event in the notification occurred.
-
#icon ⇒ String?
Icon resource for the Android notification.
-
#image ⇒ String?
URL of an image to be displayed in the notification.
-
#light_settings ⇒ LightSettings?
Settings to control the notification’s LED blinking rate and color if LED is available on the device.
-
#local_only ⇒ Boolean?
Sets whether or not this notification is relevant only to the current device.
-
#notification_count ⇒ Integer?
Sets the number of items this notification represents.
-
#priority ⇒ String?
Sets the relative priority for this notification.
-
#sound ⇒ String?
File name of the sound to be played when the device receives the notification.
-
#sticky ⇒ Boolean?
When set to ‘false` or unset, the notification is automatically dismissed when the user clicks it in the panel.
-
#tag ⇒ String?
Notification tag.
-
#ticker ⇒ String?
Sets the “ticker” text, which is sent to accessibility services.
-
#title ⇒ String?
Title of the Android notification.
-
#title_loc_args ⇒ Array<String>?
An array of resource keys that will be used in place of the format specifiers in #title_loc_key.
-
#title_loc_key ⇒ String?
Key of the title string in the app’s string resource to use to localize the title text.
-
#vibrate_timings ⇒ Array<Numeric>?
Sets the vibration pattern to use.
-
#visibility ⇒ String?
Sets the visibility of the notification.
Instance Method Summary collapse
Constructor Details
#initialize(title: nil, body: nil, icon: nil, color: nil, sound: nil, tag: nil, image: nil, click_action: nil, body_loc_key: nil, body_loc_args: nil, title_loc_key: nil, title_loc_args: nil, channel_id: nil, ticker: nil, sticky: nil, event_time: nil, local_only: nil, priority: nil, vibrate_timings: nil, default_vibrate_timings: nil, default_sound: nil, light_settings: nil, default_light_settings: nil, visibility: nil, notification_count: nil) ⇒ AndroidNotification
Initializes an AndroidNotification
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 165 def initialize( title: nil, body: nil, icon: nil, color: nil, sound: nil, tag: nil, image: nil, click_action: nil, body_loc_key: nil, body_loc_args: nil, title_loc_key: nil, title_loc_args: nil, channel_id: nil, ticker: nil, sticky: nil, event_time: nil, local_only: nil, priority: nil, vibrate_timings: nil, default_vibrate_timings: nil, default_sound: nil, light_settings: nil, default_light_settings: nil, visibility: nil, notification_count: nil ) self.title = title self.body = body self.icon = icon self.color = color self.sound = sound self.tag = tag self.image = image self.click_action = click_action self.body_loc_key = body_loc_key self.body_loc_args = body_loc_args self.title_loc_key = title_loc_key self.title_loc_args = title_loc_args self.channel_id = channel_id self.ticker = ticker self.sticky = sticky self.event_time = event_time self.local_only = local_only self.priority = priority self.vibrate_timings = vibrate_timings self.default_vibrate_timings = default_vibrate_timings self.default_sound = default_sound self.light_settings = light_settings self.default_light_settings = default_light_settings self.visibility = visibility self.notification_count = notification_count end |
Instance Attribute Details
#body ⇒ String?
Returns Body of the Android notification. When provided, overrides the body set via Notification.
12 13 14 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 12 def body @body end |
#body_loc_args ⇒ Array<String>?
Returns An array of resource keys that will be used in place of the format specifiers in #body_loc_key.
46 47 48 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 46 def body_loc_args @body_loc_args end |
#body_loc_key ⇒ String?
Returns Key of the body string in the app’s string resource to use to localize the body text.
42 43 44 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 42 def body_loc_key @body_loc_key end |
#channel_id ⇒ String?
Returns The Android notification channel id (new in Android O). The app must create a channel with this channel id before any notification with this channel id can be received. If you don’t send this channel id in the request, or if the channel id provided has not yet been created by the app, FCM uses the channel id specified in the app manifest.
61 62 63 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 61 def channel_id @channel_id end |
#click_action ⇒ String?
Returns 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.
38 39 40 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 38 def click_action @click_action end |
#color ⇒ String?
Returns Notification icon color in ‘#rrggbb` format.
20 21 22 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 20 def color @color end |
#default_light_settings ⇒ Boolean?
Returns If set to ‘true`, use the Android framework’s default LED light settings for the notification. Default values are specified in ‘config.xml`. If `default_light_settings` is set to `true` and `light_settings` is also set, the user-specified `light_settings` is used instead of the default value.
122 123 124 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 122 def default_light_settings @default_light_settings end |
#default_sound ⇒ Boolean?
Returns If set to ‘true`, use the Android framework’s default sound for the notification. Default values are specified in ‘config.xml`.
110 111 112 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 110 def default_sound @default_sound end |
#default_vibrate_timings ⇒ Boolean?
Returns If set to ‘true`, use the Android framework’s default vibrate pattern for the notification. Default values are specified in ‘config.xml`. If `default_vibrate_timings` is set to `true` and `vibrate_timings` is also set, the default value is used instead of the user-specified `vibrate_timings`.
104 105 106 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 104 def default_vibrate_timings @default_vibrate_timings end |
#event_time ⇒ Time?
Returns For notifications that inform users about events with an absolute time reference, sets the time that the event in the notification occurred. Notifications in the panel are sorted by this time.
76 77 78 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 76 def event_time @event_time end |
#icon ⇒ String?
Returns Icon resource for the Android notification.
16 17 18 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 16 def icon @icon end |
#image ⇒ String?
Returns URL of an image to be displayed in the notification.
33 34 35 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 33 def image @image end |
#light_settings ⇒ LightSettings?
Returns Settings to control the notification’s LED blinking rate and color if LED is available on the device. The total blinking time is controlled by the OS.
115 116 117 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 115 def light_settings @light_settings end |
#local_only ⇒ Boolean?
Returns Sets whether or not this notification is relevant only to the current device. Some notifications can be bridged to other devices for remote display, such as a Wear OS watch. This hint can be set to recommend this notification not be bridged.
82 83 84 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 82 def local_only @local_only end |
#notification_count ⇒ Integer?
Returns Sets the number of items this notification represents. May be displayed as a badge count for Launchers that support badging. For example, this might be useful if you’re using just one notification to represent multiple new messages but you want the count here to represent the number of total new messages. If zero or unspecified, systems that support badging use the default, which is to increment a number displayed on the long-press menu each time a new notification arrives.
136 137 138 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 136 def notification_count @notification_count end |
#priority ⇒ String?
Returns Sets the relative priority for this notification. Low-priority notifications may be hidden from the user in certain situations. Note this priority differs from ‘AndroidMessagePriority`. This priority is processed by the client after the message has been delivered. Whereas `AndroidMessagePriority` is an FCM concept that controls when the message is delivered.
89 90 91 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 89 def priority @priority end |
#sound ⇒ String?
Returns File name of the sound to be played when the device receives the notification.
24 25 26 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 24 def sound @sound end |
#sticky ⇒ Boolean?
Returns When set to ‘false` or unset, the notification is automatically dismissed when the user clicks it in the panel. When set to `true`, the notification persists even when the user clicks it.
71 72 73 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 71 def sticky @sticky end |
#tag ⇒ String?
Returns Notification tag. This is an identifier used to replace existing notifications in the notification drawer. If not specified, each request creates a new notification.
29 30 31 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 29 def tag @tag end |
#ticker ⇒ String?
Returns Sets the “ticker” text, which is sent to accessibility services. Prior to API level 21 (Lollipop), sets the text that is displayed in the status bar when the notification first arrives.
66 67 68 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 66 def ticker @ticker end |
#title ⇒ String?
Returns Title of the Android notification. When provided, overrides the title set via Notification.
8 9 10 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 8 def title @title end |
#title_loc_args ⇒ Array<String>?
Returns An array of resource keys that will be used in place of the format specifiers in #title_loc_key.
54 55 56 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 54 def title_loc_args @title_loc_args end |
#title_loc_key ⇒ String?
Returns Key of the title string in the app’s string resource to use to localize the title text.
50 51 52 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 50 def title_loc_key @title_loc_key end |
#vibrate_timings ⇒ Array<Numeric>?
Returns Sets the vibration pattern to use. Pass in an array of numeric durations to turn the vibrator on or off. The first value indicates the duration to wait before turning the vibrator on. The next value indicates the duration to keep the vibrator on. Subsequent values alternate between duration to turn the vibrator off and to turn the vibrator on. If ‘vibrate_timings` is set and `default_vibrate_timings` is set to `true`, the default value is used instead of the user-specified `vibrate_timings`.
97 98 99 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 97 def vibrate_timings @vibrate_timings end |
#visibility ⇒ String?
Returns Sets the visibility of the notification. Must be either ‘private`, `public`, or `secret`. If unspecified, defaults to `private`.
127 128 129 |
# File 'lib/firebase/admin/messaging/android_notification.rb', line 127 def visibility @visibility end |