public NotificationRequest(string id, NotificationContent content, DateTime nextTriggerDate, NotificationRepeat repeat) { this.id = id; this.content = content; this.nextTriggerDate = nextTriggerDate; this.repeat = repeat; }
public static double ToSecondInterval(this NotificationRepeat t) { TimeSpan ts = t.ToTimeSpanInterval(); Debug.Log($"Set notification repeat / NotificationRepeat = {t} TotalSeconds = {ts.TotalSeconds}"); return(ts.TotalSeconds); }
public static TimeSpan ToTimeSpanInterval(this NotificationRepeat t) { TimeSpan ts; switch (t) { case NotificationRepeat.EveryMinute: ts = TimeSpan.FromMinutes(1); break; case NotificationRepeat.EveryHour: ts = TimeSpan.FromHours(1); break; case NotificationRepeat.EveryDay: ts = TimeSpan.FromDays(1); break; case NotificationRepeat.EveryWeek: ts = TimeSpan.FromDays(7); break; default: ts = TimeSpan.Zero; break; } return(ts); }
public static void Notification_Show(int u_BargeCount, NotificationRepeat u_Repeat, string Image = default) { var request = new NotificationRequest { NotificationId = 100, Title = "Title", Description = "Description", BadgeNumber = u_BargeCount, Repeats = u_Repeat, Sound = null, Android = { IconName = Image, }, }; NotificationCenter.Current.Show(request); }
public static double ToSecondInterval(this NotificationRepeat t) { switch (t) { case NotificationRepeat.EveryMinute: return(TimeSpan.FromMinutes(1).TotalSeconds); case NotificationRepeat.EveryHour: return(TimeSpan.FromHours(1).TotalSeconds); case NotificationRepeat.EveryDay: return(TimeSpan.FromDays(1).TotalSeconds); case NotificationRepeat.EveryWeek: return(TimeSpan.FromDays(7).TotalSeconds); default: return(TimeSpan.Zero.TotalSeconds); } }
protected override T PrepareContent <T> (NotificationModel model) { NotificationLocal local = GetLocal(model.locals); NotificationRepeat nr = NotificationsHelper.GetRepeatType(model); var n = new AndroidNotification { Title = local.title, Text = local.body, ShowTimestamp = true, Color = Color.red, ShouldAutoCancel = true, Group = GroupId, GroupSummary = true, GroupAlertBehaviour = GroupAlertBehaviours.GroupAlertAll }; if (nr != NotificationRepeat.None) { n.RepeatInterval = nr.ToTimeSpanInterval(); } return((T)(object)n); }
internal static extern void _ScheduleRepeatLocalNotification(string identifier, ref iOSNotificationContent content, ref iOSDateComponents dateComponents, NotificationRepeat repeat);
public void ScheduleLocalNotification(string id, TimeSpan delay, NotificationContent content, NotificationRepeat repeat) { if (!mIsInitialized) { Debug.Log("Please initialize first."); return; } AndroidNotificationNative._ScheduleLocalNotification( id, (long)delay.TotalSeconds, repeat == NotificationRepeat.None ? -1 : (long)repeat.ToSecondInterval(), content.title, content.body, content.userInfo != null ? Json.Serialize(content.userInfo) : "", string.IsNullOrEmpty(content.categoryId) ? mSettings.DefaultCategory.id : content.categoryId, // use Default category if none is specified content.smallIcon, content.largeIcon ); }
/// <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); }
public void ScheduleLocalNotification(string id, TimeSpan delay, NotificationContent content, NotificationRepeat repeat) { if (repeat == NotificationRepeat.None) { ScheduleLocalNotification(id, delay, content); return; } if (!mIsInitialized) { Debug.Log("Please initialize first."); return; } // Prepare iOSNotificationContent var iOSContent = iOSNotificationHelper.ToIOSNotificationContent(content); // Prepare dateComponents var fireDate = DateTime.Now + delay; var dateComponents = new iOSDateComponents(); dateComponents.year = fireDate.Year; dateComponents.month = fireDate.Month; dateComponents.day = fireDate.Day; dateComponents.hour = fireDate.Hour; dateComponents.minute = fireDate.Minute; dateComponents.second = fireDate.Second; iOSNotificationNative._ScheduleRepeatLocalNotification(id, ref iOSContent, ref dateComponents, repeat); }
/// <summary> /// if Repeats = TimeInterval, then repeat again after specified amount of time elapses /// </summary> public NotificationRequestScheduleBuilder SetNotificationRepeatInterval(NotificationRepeat repeatType, TimeSpanExt?repeatInterval = null) { _schedule.RepeatType = repeatType; _schedule.NotifyRepeatInterval = repeatInterval; return(this); }
public void ScheduleLocalNotification(string id, TimeSpan delay, NotificationContent content, NotificationRepeat repeat) { }
/// <summary> /// if Repeats = TimeInterval, then repeat again after specified amount of time elapses /// </summary> public NotificationRequestBuilder SetNotificationRepeatInterval(NotificationRepeat repeatInterval, TimeSpanExt?timeSpanExt) { RepeatInterval = repeatInterval; RepeatSpan = timeSpanExt; return(this); }