You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(fcm): Add 12 new Android Notification Parameters Support (#684)
Discussion
- Introduce support for the new Android notification parameters in FCM API to AdminSDK.
Testing
- Added unit tests and integration tests to reflect this change.
API Changes
- In Messaging added new fields to AndroidNotification interface.
- Introduced LightSettings interface
RELEASE NOTE: Added a series of new parameters to the AndroidNotification class that allow further customization of notifications that target Android devices.
* Sets the "ticker" text, which is sent to accessibility services. Prior to
4006
+
* API level 21 (Lollipop), sets the text that is displayed in the status bar
4007
+
* when the notification first arrives.
4008
+
*/
4009
+
ticker?: string;
4010
+
4011
+
/**
4012
+
* When set to `false` or unset, the notification is automatically dismissed when
4013
+
* the user clicks it in the panel. When set to `true`, the notification persists
4014
+
* even when the user clicks it.
4015
+
*/
4016
+
sticky?: boolean;
4017
+
4018
+
/**
4019
+
* For notifications that inform users about events with an absolute time reference, sets
4020
+
* the time that the event in the notification occurred. Notifications
4021
+
* in the panel are sorted by this time.
4022
+
*/
4023
+
eventTimestamp?: Date;
4024
+
4025
+
/**
4026
+
* Sets whether or not this notification is relevant only to the current device.
4027
+
* Some notifications can be bridged to other devices for remote display, such as
4028
+
* a Wear OS watch. This hint can be set to recommend this notification not be bridged.
4029
+
* See [Wear OS guides](https://developer.android.com/training/wearables/notifications/bridger#existing-method-of-preventing-bridging)
4030
+
*/
4031
+
localOnly?: boolean;
4032
+
4033
+
/**
4034
+
* Sets the relative priority for this notification. Low-priority notifications
4035
+
* may be hidden from the user in certain situations. Note this priority differs
4036
+
* from `AndroidMessagePriority`. This priority is processed by the client after
4037
+
* the message has been delivered. Whereas `AndroidMessagePriority` is an FCM concept
4038
+
* that controls when the message is delivered.
4039
+
*/
4040
+
priority?: ('min'|'low'|'default'|'high'|'max');
4041
+
4042
+
/**
4043
+
* Sets the vibration pattern to use. Pass in an array of milliseconds to
4044
+
* turn the vibrator on or off. The first value indicates the duration to wait before
4045
+
* turning the vibrator on. The next value indicates the duration to keep the
4046
+
* vibrator on. Subsequent values alternate between duration to turn the vibrator
4047
+
* off and to turn the vibrator on. If `vibrate_timings` is set and `default_vibrate_timings`
4048
+
* is set to `true`, the default value is used instead of the user-specified `vibrate_timings`.
4049
+
*/
4050
+
vibrateTimingsMillis?: number[];
4051
+
4052
+
/**
4053
+
* If set to `true`, use the Android framework's default vibrate pattern for the
4054
+
* notification. Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
4055
+
* If `default_vibrate_timings` is set to `true` and `vibrate_timings` is also set,
4056
+
* the default value is used instead of the user-specified `vibrate_timings`.
4057
+
*/
4058
+
defaultVibrateTimings?: boolean;
4059
+
4060
+
/**
4061
+
* If set to `true`, use the Android framework's default sound for the notification.
4062
+
* Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
4063
+
*/
4064
+
defaultSound?: boolean;
4065
+
4066
+
/**
4067
+
* Settings to control the notification's LED blinking rate and color if LED is
4068
+
* available on the device. The total blinking time is controlled by the OS.
4069
+
*/
4070
+
lightSettings?: LightSettings;
4071
+
4072
+
/**
4073
+
* If set to `true`, use the Android framework's default LED light settings
4074
+
* for the notification. Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
4075
+
* If `default_light_settings` is set to `true` and `light_settings` is also set,
4076
+
* the user-specified `light_settings` is used instead of the default value.
4077
+
*/
4078
+
defaultLightSettings?: boolean;
4079
+
4080
+
/**
4081
+
* Sets the visibility of the notification. Must be either `private`, `public`,
4082
+
* or `secret`. If unspecified, defaults to `private`.
4083
+
*/
4084
+
visibility?: ('private'|'public'|'secret');
4085
+
4086
+
/**
4087
+
* Sets the number of items this notification represents. May be displayed as a
4088
+
* badge count for Launchers that support badging. See [`NotificationBadge`(https://developer.android.com/training/notify-user/badges).
4089
+
* For example, this might be useful if you're using just one notification to
4090
+
* represent multiple new messages but you want the count here to represent
4091
+
* the number of total new messages. If zero or unspecified, systems
4092
+
* that support badging use the default, which is to increment a number
4093
+
* displayed on the long-press menu each time a new notification arrives.
4094
+
*/
4095
+
notificationCount?: number;
4096
+
}
4097
+
4098
+
/**
4099
+
* Represents settings to control notification LED that can be included in
4100
+
* {@link admin.messaging.AndroidNotification}.
4101
+
*/
4102
+
interfaceLightSettings{
4103
+
/**
4104
+
* Required. Sets color of the LED in `#rrggbb` or `#rrggbbaa` format.
4105
+
*/
4106
+
color: string;
4107
+
4108
+
/**
4109
+
* Required. Along with `light_off_duration`, defines the blink rate of LED flashes.
4110
+
*/
4111
+
lightOnDurationMillis: number;
4112
+
4113
+
/**
4114
+
* Required. Along with `light_on_duration`, defines the blink rate of LED flashes.
0 commit comments