Class: Google::Apis::FcmV1::AndroidNotification
- Inherits:
-
Object
- Object
- Google::Apis::FcmV1::AndroidNotification
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/fcm_v1/classes.rb,
lib/google/apis/fcm_v1/representations.rb,
lib/google/apis/fcm_v1/representations.rb
Overview
Notification to send to android devices.
Instance Attribute Summary collapse
-
#body ⇒ String
The notification's body text.
-
#body_loc_args ⇒ Array<String>
Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.
-
#body_loc_key ⇒ String
The key to the body string in the app's string resources to use to localize the body text to the user's current localization.
-
#bypass_proxy_notification ⇒ Boolean
(also: #bypass_proxy_notification?)
If set, display notifications delivered to the device will be handled by the app instead of the proxy.
-
#channel_id ⇒ String
The notification's channel id (new in Android O).
-
#click_action ⇒ String
The action associated with a user click on the notification.
-
#color ⇒ String
The notification's icon color, expressed in #rrggbb format.
-
#default_light_settings ⇒ Boolean
(also: #default_light_settings?)
If set to true, use the Android framework's default LED light settings for the notification.
-
#default_sound ⇒ Boolean
(also: #default_sound?)
If set to true, use the Android framework's default sound for the notification.
-
#default_vibrate_timings ⇒ Boolean
(also: #default_vibrate_timings?)
If set to true, use the Android framework's default vibrate pattern for the notification.
-
#event_time ⇒ String
Set the time that the event in the notification occurred.
-
#icon ⇒ String
The notification's icon.
-
#image ⇒ String
Contains the URL of an image that is going to be displayed in a notification.
-
#light_settings ⇒ Google::Apis::FcmV1::LightSettings
Settings to control notification LED.
-
#local_only ⇒ Boolean
(also: #local_only?)
Set whether or not this notification is relevant only to the current device.
-
#notification_count ⇒ Fixnum
Sets the number of items this notification represents.
-
#notification_priority ⇒ String
Set the relative priority for this notification.
-
#proxy ⇒ String
Setting to control when a notification may be proxied.
-
#sound ⇒ String
The sound to play when the device receives the notification.
-
#sticky ⇒ Boolean
(also: #sticky?)
When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.
-
#tag ⇒ String
Identifier used to replace existing notifications in the notification drawer.
-
#ticker ⇒ String
Sets the "ticker" text, which is sent to accessibility services.
-
#title ⇒ String
The notification's title.
-
#title_loc_args ⇒ Array<String>
Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.
-
#title_loc_key ⇒ String
The key to the title string in the app's string resources to use to localize the title text to the user's current localization.
-
#vibrate_timings ⇒ Array<String>
Set the vibration pattern to use.
-
#visibility ⇒ String
Set the Notification.visibility of the notification.
Instance Method Summary collapse
-
#initialize(**args) ⇒ AndroidNotification
constructor
A new instance of AndroidNotification.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ AndroidNotification
Returns a new instance of AndroidNotification.
342 343 344 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 342 def initialize(**args) update!(**args) end |
Instance Attribute Details
#body ⇒ String
The notification's body text. If present, it will override google.firebase.fcm.
v1.Notification.body.
Corresponds to the JSON property body
131 132 133 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 131 def body @body end |
#body_loc_args ⇒ Array<String>
Variable string values to be used in place of the format specifiers in
body_loc_key to use to localize the body text to the user's current
localization. See Formatting and Styling for more
information.
Corresponds to the JSON property bodyLocArgs
139 140 141 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 139 def body_loc_args @body_loc_args end |
#body_loc_key ⇒ String
The key to the body string in the app's string resources to use to localize
the body text to the user's current localization. See String Resources for more information.
Corresponds to the JSON property bodyLocKey
146 147 148 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 146 def body_loc_key @body_loc_key end |
#bypass_proxy_notification ⇒ Boolean Also known as: bypass_proxy_notification?
If set, display notifications delivered to the device will be handled by the
app instead of the proxy.
Corresponds to the JSON property bypassProxyNotification
152 153 154 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 152 def bypass_proxy_notification @bypass_proxy_notification end |
#channel_id ⇒ String
The notification's channel id (new in Android O). The app must
create a channel with this channel ID before any notification with this
channel ID is 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.
Corresponds to the JSON property channelId
163 164 165 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 163 def channel_id @channel_id end |
#click_action ⇒ String
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.
Corresponds to the JSON property clickAction
170 171 172 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 170 def click_action @click_action end |
#color ⇒ String
The notification's icon color, expressed in #rrggbb format.
Corresponds to the JSON property color
175 176 177 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 175 def color @color end |
#default_light_settings ⇒ Boolean Also known as: default_light_settings?
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.
Corresponds to the JSON property defaultLightSettings
184 185 186 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 184 def default_light_settings @default_light_settings end |
#default_sound ⇒ Boolean Also known as: default_sound?
If set to true, use the Android framework's default sound for the notification.
Default values are specified in config.xml.
Corresponds to the JSON property defaultSound
192 193 194 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 192 def default_sound @default_sound end |
#default_vibrate_timings ⇒ Boolean Also known as: default_vibrate_timings?
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
.
Corresponds to the JSON property defaultVibrateTimings
203 204 205 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 203 def default_vibrate_timings @default_vibrate_timings end |
#event_time ⇒ String
Set the time that the event in the notification occurred. Notifications in the
panel are sorted by this time. A point in time is represented using protobuf.
Timestamp.
Corresponds to the JSON property eventTime
212 213 214 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 212 def event_time @event_time end |
#icon ⇒ String
The notification's icon. Sets the notification icon to myicon for drawable
resource myicon. If you don't send this key in the request, FCM displays the
launcher icon specified in your app manifest.
Corresponds to the JSON property icon
219 220 221 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 219 def icon @icon end |
#image ⇒ String
Contains the URL of an image that is going to be displayed in a notification.
If present, it will override google.firebase.fcm.v1.Notification.image.
Corresponds to the JSON property image
225 226 227 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 225 def image @image end |
#light_settings ⇒ Google::Apis::FcmV1::LightSettings
Settings to control notification LED.
Corresponds to the JSON property lightSettings
230 231 232 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 230 def light_settings @light_settings end |
#local_only ⇒ Boolean Also known as: local_only?
Set 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. See Wear OS guides
Corresponds to the JSON property localOnly
239 240 241 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 239 def local_only @local_only end |
#notification_count ⇒ Fixnum
Sets the number of items this notification represents. May be displayed as a
badge count for launchers that support badging.See Notification Badge. 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.
Corresponds to the JSON property notificationCount
252 253 254 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 252 def notification_count @notification_count end |
#notification_priority ⇒ String
Set the relative priority for this notification. Priority is an indication of
how much of the user's attention should be consumed by this notification. Low-
priority notifications may be hidden from the user in certain situations,
while the user might be interrupted for a higher-priority notification. The
effect of setting the same priorities may differ slightly on different
platforms. 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.
Corresponds to the JSON property notificationPriority
266 267 268 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 266 def notification_priority @notification_priority end |
#proxy ⇒ String
Setting to control when a notification may be proxied.
Corresponds to the JSON property proxy
271 272 273 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 271 def proxy @proxy end |
#sound ⇒ String
The sound to play when the device receives the notification. Supports "default"
or the filename of a sound resource bundled in the app. Sound files must
reside in /res/raw/.
Corresponds to the JSON property sound
278 279 280 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 278 def sound @sound end |
#sticky ⇒ Boolean Also known as: sticky?
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.
Corresponds to the JSON property sticky
285 286 287 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 285 def sticky @sticky end |
#tag ⇒ String
Identifier used to replace existing notifications in the notification drawer.
If not specified, each request creates a new notification. If specified and a
notification with the same tag is already being shown, the new notification
replaces the existing one in the notification drawer.
Corresponds to the JSON property tag
294 295 296 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 294 def tag @tag end |
#ticker ⇒ String
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.
Corresponds to the JSON property ticker
301 302 303 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 301 def ticker @ticker end |
#title ⇒ String
The notification's title. If present, it will override google.firebase.fcm.v1.
Notification.title.
Corresponds to the JSON property title
307 308 309 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 307 def title @title end |
#title_loc_args ⇒ Array<String>
Variable string values to be used in place of the format specifiers in
title_loc_key to use to localize the title text to the user's current
localization. See Formatting and Styling for more
information.
Corresponds to the JSON property titleLocArgs
315 316 317 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 315 def title_loc_args @title_loc_args end |
#title_loc_key ⇒ String
The key to the title string in the app's string resources to use to localize
the title text to the user's current localization. See String Resources for more information.
Corresponds to the JSON property titleLocKey
322 323 324 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 322 def title_loc_key @title_loc_key end |
#vibrate_timings ⇒ Array<String>
Set the vibration pattern to use. Pass in an array of protobuf.Duration to turn on or off the vibrator. 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
.
Corresponds to the JSON property vibrateTimings
334 335 336 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 334 def vibrate_timings @vibrate_timings end |
#visibility ⇒ String
Set the Notification.visibility of the notification.
Corresponds to the JSON property visibility
340 341 342 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 340 def visibility @visibility end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/google/apis/fcm_v1/classes.rb', line 347 def update!(**args) @body = args[:body] if args.key?(:body) @body_loc_args = args[:body_loc_args] if args.key?(:body_loc_args) @body_loc_key = args[:body_loc_key] if args.key?(:body_loc_key) @bypass_proxy_notification = args[:bypass_proxy_notification] if args.key?(:bypass_proxy_notification) @channel_id = args[:channel_id] if args.key?(:channel_id) @click_action = args[:click_action] if args.key?(:click_action) @color = args[:color] if args.key?(:color) @default_light_settings = args[:default_light_settings] if args.key?(:default_light_settings) @default_sound = args[:default_sound] if args.key?(:default_sound) @default_vibrate_timings = args[:default_vibrate_timings] if args.key?(:default_vibrate_timings) @event_time = args[:event_time] if args.key?(:event_time) @icon = args[:icon] if args.key?(:icon) @image = args[:image] if args.key?(:image) @light_settings = args[:light_settings] if args.key?(:light_settings) @local_only = args[:local_only] if args.key?(:local_only) @notification_count = args[:notification_count] if args.key?(:notification_count) @notification_priority = args[:notification_priority] if args.key?(:notification_priority) @proxy = args[:proxy] if args.key?(:proxy) @sound = args[:sound] if args.key?(:sound) @sticky = args[:sticky] if args.key?(:sticky) @tag = args[:tag] if args.key?(:tag) @ticker = args[:ticker] if args.key?(:ticker) @title = args[:title] if args.key?(:title) @title_loc_args = args[:title_loc_args] if args.key?(:title_loc_args) @title_loc_key = args[:title_loc_key] if args.key?(:title_loc_key) @vibrate_timings = args[:vibrate_timings] if args.key?(:vibrate_timings) @visibility = args[:visibility] if args.key?(:visibility) end |