Esempio n. 1
0
 /// <summary>
 /// Sends a notification to all registered devices.
 /// </summary>
 /// <typeparam name="TData">The type of data sent in the notification payload.</typeparam>
 /// <param name="service">Instance of <see cref="IPushNotificationService"/>.</param>
 /// <param name="title">Message of notification.</param>
 /// <param name="body">Body of notification.</param>
 /// <param name="data">Data passed to mobile client, not visible to notification toast.</param>
 /// <param name="classification">The type of the Push Notification.</param>
 public static Task BroadcastAsync <TData>(this IPushNotificationService service, string title, string body, TData data, string classification = null) where TData : class =>
 service.BroadcastAsync(title, body, data != null ? JsonSerializer.Serialize(data, JsonSerializerOptionDefaults.GetDefaultSettings()) : null, classification);