Skip to content

4. Repeat Notification

Elvin (Tharindu) Thudugala edited this page Jul 6, 2023 · 1 revision

To repeat a notification, notification must be Scheduled. You can Schedule notification by setting NotifyTime in NotificationRequest.

There are 3 repeat patterns, you can specify one of them by setting Repeats in NotificationRequest

  1. Daily (Notification should repeat the next day at the same time)
  2. Weekly (Notification should repeat next week on same day, same time)
  3. TimeInterval (Notification to be delivered after the specified amount of time elapses)

if the pattern is TimeInterval you must set NotifyRepeatInterval in NotificationRequest

in iOS, not allowed delay and repeat when using TimeInterval

example

var notification = new NotificationRequest
{
    NotificationId = 100,
    Title = "Test",
    Description = "Test Description",
    Schedule = 
    {
        NotifyTime = DateTime.Now.AddHours(1),
        RepeatType = NotificationRepeat.TimeInterval,
        NotifyRepeatInterval = TimeSpan.FromMinutes(2)
    }
};
LocalNotificationCenter.Current.Show(notification);