How can I be notified whenever any application delivers or activates an NSUserNotification
?
NSDistributedNotificationCenter
, NSUserNotificationDeliveredMask
[dummy name] I could register a global [NSEvent addGlobalMonitorForEventsMatchingMask]
for, The [NSUserNotificationCenter defaultCenter]
and its delegate only notify me when my own app delivers a notification.
This answer should address how to receive available notifications from NSDistributedNotificationCenter
. There doesn't seem to be any way to get all NSUsernotifications
as far as I know, though.
It is not possible. You can only listen to NSDistributedNotificationCenter
for "global" notifications. The app developer has to broadcast to NSDistributedNotificationCenter
for you to hook into it.
You can't hijack other applications Notifications. Most apps and all apps distributed through App Store is sandboxed. The very nature of this limits your ability to hook into them!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.