public TopicUnicastMessage(FcmMessageOptions options, Topic topic, NotificationPayload notification) : base(options, notification) { if (topic == null) { throw new ArgumentNullException("topic"); } To = topic.getTopicPath(); }
public FcmMessage(FcmMessageOptions options, NotificationPayload notification) { Notification = notification; CollapseKey = options.CollapseKey; Priority = options.PriorityEnum; ContentAvailable = options.ContentAvailable; DelayWhileIdle = options.DelayWhileIdle; TimeToLive = options.TimeToLive; DryRun = options.DryRun; }
public static void Main(string[] args) { // Read the API Key from a File, which is not under Version Control: var settings = new FileBasedFcmClientSettings("/Users/bytefish/api.key"); // Construct the Client: using (var client = new FcmClient(settings)) { // Construct the Data Payload to send: var data = new { A = new { a = 1, b = 2 }, B = 2, }; // Options for the Message: var options = FcmMessageOptions.Builder() .setTimeToLive(TimeSpan.FromDays(1)) .Build(); // The Message should be sent to the News Topic: var message = new TopicUnicastMessage <dynamic>(options, new Topic("news"), data); // Finally send the Message and wait for the Result: CancellationTokenSource cts = new CancellationTokenSource(); // Send the Message and wait synchronously: var result = client.SendAsync(message, cts.Token).GetAwaiter().GetResult(); // Print the Result to the Console: System.Console.WriteLine("Result = {0}", result); } }
public FcmMulticastMessage(FcmMessageOptions options, IList <string> registrationIds, NotificationPayload notification) : base(options, notification) { RegistrationIds = registrationIds; }
public TopicMulticastMessage(FcmMessageOptions options, TopicList topicList, NotificationPayload notification) : base(options, notification) { Condition = topicList.GetTopicsCondition(); }
public FcmUnicastMessage(FcmMessageOptions options, String to, NotificationPayload notification) : base(options, notification) { To = to; }