Can we send Local Push Notifications from DeviceActivityMonitor extension?

I'm wondering if we able to send Local Push Notifications from DeviceActivityMonitor extension...

  1. If we have to use AppGroups to pass info between an app and the extension, could we post notification though UNNotificationRequest?

  2. I also tried to push data through NotificationCenter, also doesn’t work. Can we do so, or did something wrong?

  3. Should these cases that I described above work from iOS 16 and above or not?

Thank you!

  1. Yes, you should be able to post user notifications from a DeviceActivity monitor extension. If you are unable to do so, please file a bug report using Feedback Assistant.
  2. No, a NotificationCenter can only deliver notifications within a single program; it does not allow you to post a notification to other processes or receive notifications from other processes (i.e. you cannot use it to post notifications between your monitor extension and your main app).

Do you have an example of using App Group to share data? My DeviceActivityMonitor extension is firing the intervalDidStart(), but the categoryTokens in stored in the shared model are empty when it fires. However, when I run it using a button action in the foreground, the categoryTokens are founded and successfully shielded.

I tried adding App Group capability to the main app target, and the DeviceActivityMonitorExtension target. Any insight would be appreciated.

Can we send Local Push Notifications from DeviceActivityMonitor extension?
 
 
Q