Class: Firebase::Admin::Messaging::AndroidConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/firebase/admin/messaging/android_config.rb

Overview

Android-specific options that can be included in a Message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collapse_key: nil, priority: nil, ttl: nil, restricted_package_name: nil, data: nil, notification: nil, fcm_options: nil) ⇒ AndroidConfig

Parameters:

  • collapse_key (String, nil) (defaults to: nil)

    Collapse key string for the message (optional).

  • priority (String, nil) (defaults to: nil)

    Priority of the message (optional). Must be either ‘high` or `normal`.

  • ttl (Numeric, nil) (defaults to: nil)

    The time-to-live duration of the message (optional). Time-to-live duration of the message in seconds.

  • restricted_package_name (String, nil) (defaults to: nil)

    The package name of the application where the registration tokens must match in order to receive the message (optional).

  • data (Hash{String,Symbol => String}, nil) (defaults to: nil)

    A hash of data fields to be included in the message (optional). All keys and values must be strings.

  • notification (AndroidNotification, nil) (defaults to: nil)

    An Firebase::Admin::Messaging::AndroidNotification to be included in the message (optional).

  • fcm_options (AndroidFCMOptions, nil) (defaults to: nil)

    An Firebase::Admin::Messaging::AndroidFCMOptions to be included in the message (optional).



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/firebase/admin/messaging/android_config.rb', line 57

def initialize(
  collapse_key: nil,
  priority: nil,
  ttl: nil,
  restricted_package_name: nil,
  data: nil,
  notification: nil,
  fcm_options: nil
)
  self.collapse_key = collapse_key
  self.priority = priority
  self.ttl = ttl
  self.restricted_package_name = restricted_package_name
  self.data = data
  self.notification = notification
  self.fcm_options = fcm_options
end

Instance Attribute Details

#collapse_keyString?

Returns Collapse key string for the message. This is an identifier for a group of messages that can be collapsed, so that only the last message is sent when delivery can be resumed. A maximum of 4 different collapse keys may be active at a given time.

Returns:

  • (String, nil)

    Collapse key string for the message. This is an identifier for a group of messages that can be collapsed, so that only the last message is sent when delivery can be resumed. A maximum of 4 different collapse keys may be active at a given time.



10
11
12
# File 'lib/firebase/admin/messaging/android_config.rb', line 10

def collapse_key
  @collapse_key
end

#dataHash{String,Symbol => String}?

Returns A hash of data fields to be included in the message. All keys and values must be strings. When provided, overrides any data fields set on the top-level message.

Returns:

  • (Hash{String,Symbol => String}, nil)

    A hash of data fields to be included in the message. All keys and values must be strings. When provided, overrides any data fields set on the top-level message.



27
28
29
# File 'lib/firebase/admin/messaging/android_config.rb', line 27

def data
  @data
end

#fcm_optionsAndroidFCMOptions?

Returns Options for features provided by the FCM SDK for Android.

Returns:

  • (AndroidFCMOptions, nil)

    Options for features provided by the FCM SDK for Android.



35
36
37
# File 'lib/firebase/admin/messaging/android_config.rb', line 35

def fcm_options
  @fcm_options
end

#notificationAndroidNotification?

Returns Android notification to be included in the message.

Returns:



31
32
33
# File 'lib/firebase/admin/messaging/android_config.rb', line 31

def notification
  @notification
end

#priorityString?

Returns Priority of the message. Must be either ‘high` or `normal`.

Returns:

  • (String, nil)

    Priority of the message. Must be either ‘high` or `normal`.



14
15
16
# File 'lib/firebase/admin/messaging/android_config.rb', line 14

def priority
  @priority
end

#restricted_package_nameString?

Returns Package name of the application where the registration tokens must match in order to receive the message.

Returns:

  • (String, nil)

    Package name of the application where the registration tokens must match in order to receive the message.



22
23
24
# File 'lib/firebase/admin/messaging/android_config.rb', line 22

def restricted_package_name
  @restricted_package_name
end

#ttlNumeric?

Returns Time-to-live duration of the message in seconds.

Returns:

  • (Numeric, nil)

    Time-to-live duration of the message in seconds.



18
19
20
# File 'lib/firebase/admin/messaging/android_config.rb', line 18

def ttl
  @ttl
end