Receiving meaningful notifications from other apps

2019-09-13 18:23发布

问题:

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