Receiving meaningful notifications from other apps and NotificationCenter

懵懂的女人 提交于 2019-12-11 16:23:09

问题


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?


回答1:


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.

ANCS docs



来源:https://stackoverflow.com/questions/32074252/receiving-meaningful-notifications-from-other-apps-and-notificationcenter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!