Delay UNLocationNotificationTrigger on UNNotificationRequest?

153 Views Asked by At

I have properly set up location based local notifications. As of now the user receives a notification when they enter a defined zone (CLCircularRegion). Id like to delay that notification about 10 minutes after they enter the zone, could that be possible?

// SENDING WITH (UNLocationNotificationTrigger)

 let trigger = UNLocationNotificationTrigger(region: destRegion, repeats: false)
 let request = UNNotificationRequest(identifier: notificationInfo.notificationId,
                                        content: notification,
                                        trigger: trigger)
 UNUserNotificationCenter.current().add(request)

I also send notification locally for other reasons at different places in my app. This causes a delay for the elapsedSeconds.

// SENDING WITH (UNTimeIntervalNotificationTrigger)

let trigger = UNTimeIntervalNotificationTrigger(timeInterval: elapsedSeconds, repeats: false)
let request = UNNotificationRequest(identifier: "cartabandon", content: localnotification, trigger: trigger)
UNUserNotificationCenter.current().add(request)

Maybe theres a way to combine the two? Or another option?

0

There are 0 best solutions below