Sort of. The following is a workaround:
Summary
An iOS device that receives a notification while asleep will turn on the display briefly to show the notification on the lock screen.
An iOS device with ASAM enabled cannot be locked, so a received notification will instead wake up the display with the app open. Note that the banner does not display. There is no visual indicator that a notification was received.
We take advantage of this mechanism to wake up our app via a local notification whenever our app is backgrounded while in ASAM.
Caveats
This only works if the user explicitly allows notification permissions for the app. I recommend gating the app from use if these permissions are disabled and re-directing the user to Settings.
The iPad cannot be in "Do Not Disturb" which is something that MDMs are currently unable to disable. This is the biggest risk to this workaround.
The notification will be queued in the Notification Center. Once ASAM is disabled, these notifications will be visible there.
Implementation
Request user notification permissions
UNUserNotificationCenter.current().requestAuthorization(options: [.alert]) { /* ... */ }
Whenever the app is in ASAM and the iPad is put to sleep, schedule a local notification to fire within a couple seconds.
func applicationDidEnterBackground(_ application: UIApplication) {
if asamEnabled /* a flag we we track globally */ {
let content = UNMutableNotificationContent()
content.title = "Please do not put the app to sleep during an active test."
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 2, repeats: false)
let request = UNNotificationRequest(identifier: "keepAppForegrounded", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request)
}
}
Topic:
Accessibility & Inclusion
SubTopic:
General