从其他应用程序和NotificationCenter接收有意义的通知 [英] Receiving meaningful notifications from other apps and NotificationCenter
问题描述
我想要从其他应用程序接收通知,这些通知将显示在锁定屏幕上-类似于Pebble和其他智能手表如何接收它们.
很容易通过以下方式注册通知
NSNotificationCenter.defaultCenter().addObserver(self, selector: "receiveNotification:", name: nil, object: nil)
但是随后该应用会收到大量的通知,这些通知相对而言毫无意义(缓存更改,状态更改,UI更改等).
仅过滤那些出现在锁定屏幕/显示标语上的通知的最佳方法是什么?
您无法从您的应用访问其他应用的通知. Pebble应用程序也没有任何访问权限.但是,Pebble手表确实如此.因为它使用蓝牙和Apple Notification Center服务.换句话说,只有蓝牙设备可以访问有意义的"通知.您可以在下面找到有关它的更多信息.
ANCS文档 >
I want to receive notifications from other applications that would appear on lock screen- similar to how Pebble and other smart watches receive them.
It is easy to register for notifications via
NSNotificationCenter.defaultCenter().addObserver(self, selector: "receiveNotification:", name: nil, object: nil)
But then the app receives loads of notifications, most of which are relatively meaningless (cache changes, state changes, UI changes, etc).
What would be the best way to filter only those notifications, that would appear on lock screen / show banner?
You can't get access to other applications notifications from your app. Pebble app also does not have any access. But Pebble watch does. Because it uses bluetooth and Apple Notification Center Service. In other words only bluetooth devices can have access to "meaningful" notifications. You can find more info about it below.
这篇关于从其他应用程序和NotificationCenter接收有意义的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!