/// <summary> /// Schedules a local notification to be posted after the specified delay time, /// and repeat automatically after the interval specified by the repeat mode. /// Note that the scheduled notification persists even if the device reboots, and it /// will be fired immediately after the reboot if its latest scheduled fire time has passed. /// </summary> /// <returns>The ID of the scheduled notification.</returns> /// <param name="delay">Delay.</param> /// <param name="content">Notification content.</param> /// <param name="repeat">Repeat.</param> public static string ScheduleLocalNotification(TimeSpan delay, NotificationContent content, NotificationRepeat repeat) { var id = NextLocalNotificationId(); LocalNotificationClient.ScheduleLocalNotification(id, delay, content, repeat); return(id); }
/// <summary> /// Schedules a local notification to be posted at the specified time with no repeat. /// Note that the scheduled notification persists even if the device reboots, and it /// will be fired immediately after the reboot if <see cref="triggerDate"/> is past. /// </summary> /// <returns>The ID of the scheduled notification.</returns> /// <param name="triggerDate">Trigger date.</param> /// <param name="content">Notification content.</param> public static string ScheduleLocalNotification(DateTime triggerDate, NotificationContent content) { var id = NextLocalNotificationId(); LocalNotificationClient.ScheduleLocalNotification(id, triggerDate, content); return(id); }
public NotificationContent ToNotificationContent() { NotificationContent notificationContent = new NotificationContent { }; if (Notification != null) { notificationContent.title = Notification.Title; notificationContent.body = Notification.Body; notificationContent.badge = GetNotificationContentBadge(); notificationContent.largeIcon = Notification.Icon; notificationContent.smallIcon = Notification.Icon; } if (Data != null) { Dictionary <string, object> userInfo = new Dictionary <string, object>(); foreach (var data in Data) { userInfo.Add(data.Key, data.Value); } notificationContent.userInfo = userInfo; } return(notificationContent); }
public Notification(string notificationId, string actionId, NotificationContent content, bool isForeground, bool isOpened) { this.id = notificationId; this.actionId = actionId; this.content = content; this.isAppInForeground = isForeground; this.isOpened = isOpened; }
internal NotificationContent ToNotificationContent() { var content = new NotificationContent(); content.title = this.title; content.subtitle = this.subtitle; content.body = this.body; content.badge = this.badge; content.userInfo = this.additionalData; content.smallIcon = this.smallIcon; content.largeIcon = this.largeIcon; return(content); }
/// <summary> /// Initializes a new instance of the <see cref="EasyMobile.RemoteDeliveredNotification"/> class. /// This constructor will automatically build the service-specific payload object based on /// the user info dictionary (which was converted from the notification payload JSON string). /// This is intended to be used when handling generic (service-independent) remote notification events from native side. /// </summary> /// <param name="notificationId">Notification ID.</param> /// <param name="actionId">Action ID.</param> /// <param name="content">Content.</param> /// <param name="isForeground">If set to <c>true</c> is foreground.</param> /// <param name="isOpened">If set to <c>true</c> is opened.</param> public RemoteNotification(string notificationId, string actionId, NotificationContent content, bool isForeground, bool isOpened) : base(notificationId, actionId, content, isForeground, isOpened) { switch (EM_Settings.Notifications.PushNotificationService) { case PushNotificationProvider.None: break; case PushNotificationProvider.OneSignal: // Manually construct OneSignal payload from the JSON payload of the received notification. oneSignalPayload = OneSignalNotificationPayload.FromJSONDict(notificationId, content.userInfo); break; default: break; } }
public LocalNotification(string notificationId, string actionId, NotificationContent content, bool isForeground, bool isOpened) : base(notificationId, actionId, content, isForeground, isOpened) { }