I want to send a local notification every 8 hours starting at specific time. For example, now we are at 10 o'clock in the morning, but I want you to notify me every 8h starting at 12 o'clock, how I can do that.
I have this code:
let content: UNMutableNotificationContent = UNMutableNotificationContent()
content.title = "Alert!"
content.body = "Alert"
content.categoryIdentifier = "alarm"
let request = UNNotificationRequest(
identifier: "AA",
content: content,
trigger: UNTimeIntervalNotificationTrigger(timeInterval: 8*3600, repeats: false)
)
let action = UNNotificationAction(identifier: "remindLater", title: "remind_me_later".localized(), options: [])
let category = UNNotificationCategory(identifier:"pill-alarm", actions: [action], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])
UNUserNotificationCenter.current().add(request)