My app shows user notifications to the user (that pop up on the top of the screen) at random points throughout the app (they get fired remotely from the server, ie when another user sends a message to them), using the UserNotifications framework.
The notifications work perfectly when NOT in guided access mode, and they fire properly while user is in the app.
This is from app-delegate to enable notifications showing in-app:
extension AppDelegate : UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler(.alert)
}
This is how the notifications get fired (when an event gets triggered from Firebase):
func sendNotification(notTitle: String, notSubtitle: String, notBody: String) {
let notif = UNMutableNotificationContent()
notif.title = notTitle
notif.subtitle = notSubtitle
notif.body = notBody
let notifTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false)
let request = UNNotificationRequest(identifier: "myNotification", content: notif, trigger: notifTrigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}
So all the above works fine.
But my problem is, once the app goes into guided-access mode (triple tap home button - passcode locks the device to my specific app), then the notifications will not show. Guided access blocks them in some way.
It is essential for my app to be in guided access as it is provided from physical staff in a facility to clients.
Is there a way to prevent the guided access mode from blocking user notifications? Or some function I have to include in app-delegate?
I could not find anything on SO or the web regarding this issue. Any help would be greatly appreciated