33 public string Sound {
get;
set; }
42 public string Tag {
get;
set; }
47 public string Color {
get;
set; }
82 public string Icon {
get;
set; }
95 base.ExportProperties(Message);
97 Dictionary<string, object> AndroidConfig = Message.ContainsKey(
"android") && Message[
"android"] is Dictionary<string, object> ExistingAndroid
99 :
new Dictionary<string, object>();
100 Dictionary<string, object> AndroidNotification =
new Dictionary<string, object>();
103 AndroidConfig[
"priority"] = this.
Priority.ToString().ToLower();
106 AndroidConfig[
"ttl"] = this.TimeToLive +
"s";
110 if (!
string.IsNullOrEmpty(this.
Title))
111 AndroidNotification[
"title"] = this.
Title;
113 if (!
string.IsNullOrEmpty(this.
Body))
114 AndroidNotification[
"body"] = this.
Body;
117 AndroidNotification[
"click_action"] = this.
ClickAction;
120 if (!
string.IsNullOrEmpty(this.
ChannelId))
121 AndroidNotification[
"channel_id"] = this.
ChannelId;
123 AndroidNotification[
"channel_id"] =
"default";
125 if (!
string.IsNullOrEmpty(this.
Sound))
126 AndroidNotification[
"sound"] = this.
Sound;
128 if (!
string.IsNullOrEmpty(this.
Tag))
129 AndroidNotification[
"tag"] = this.
Tag;
131 if (!
string.IsNullOrEmpty(this.
Color))
132 AndroidNotification[
"color"] = this.
Color;
134 if (!
string.IsNullOrEmpty(this.
Icon))
135 AndroidNotification[
"icon"] = this.
Icon;
153 if (AndroidNotification.Count > 0)
154 AndroidConfig[
"notification"] = AndroidNotification;
160 foreach (KeyValuePair<string, object> P
in Android2)
162 if (AndroidConfig.TryGetValue(P.Key, out
object Obj) &&
163 Obj is Dictionary<string, object> Obj1 &&
164 P.Value is Dictionary<string, object> Obj2)
166 foreach (KeyValuePair<string, object> P2
in Obj2)
167 Obj1[P2.Key] = P2.Value;
170 AndroidConfig[P.Key] = P.Value;
174 if (AndroidConfig.Count > 0)
175 Message[
"android"] = AndroidConfig;
188 case "android_channel_id":
191 this.ChannelId = Value?.ToString();
195 this.Sound = Value?.ToString();
199 this.Tag = Value?.ToString();
203 this.Color = Value?.ToString();
207 this.Icon = Value?.ToString();
211 this.BodyLocalizationKey = Value?.ToString();
214 case "body_loc_args":
222 case "title_loc_key":
223 this.TitleLocalizationKey = Value?.ToString();
226 case "title_loc_args":
235 this.AndroidSpecificDeliveryOptions = Value;
239 return base.TrySetProperty(Name, Value);
Notification message for Android
string ChannelId
The notification's channel id (new in Android O).
string Color
The notification's icon color, expressed in #rrggbb format.
object AndroidSpecificDeliveryOptions
Android-specific delivery options.
string[] TitleLocalizationArguments
Variable string values to be used in place of the format specifiers in title_loc_key to use to locali...
string BodyLocalizationKey
The key to the body string in the app's string resources to use to localize the body text to the user...
string TitleLocalizationKey
The key to the title string in the app's string resources to use to localize the title text to the us...
string Sound
The sound to play when the device receives the notification.
override void ExportProperties(Dictionary< string, object > Message)
Prepares the object to send to Firebase.
string Icon
The URL to use for the notification's icon.
NotificationMessageAndroid()
Notification message for Android
string Tag
Identifier used to replace existing notifications in the notification drawer.
string[] BodyLocalizationArguments
Variable string values to be used in place of the format specifiers in body_loc_key to use to localiz...
override bool TrySetProperty(string Name, object Value)
Tries to set a property value.
Base class for Notification messages
bool SuppressNotification
If the visual notification part should be suppressed (data-only/background).
string Title
The notification's title.
string ClickAction
The action associated with a user click on the notification.
string Body
The notification's body text.
int TimeToLive
This parameter specifies how long (in seconds) the message should be kept in FCM storage if the devic...
NotificationPriority Priority
Sets the priority of the message. Valid values are "normal" and "high."