Markus Dressel
Markus Dressel

Reputation: 85

Does iOS have a 'Notification Listener'?

Is it possible to create a Notification Listener in iOS? Something like the NotificationListenerService in Android.

Edit: What I want to do is listen to any notifications coming from any app within the device (missed calls, emails, SMS...)

Upvotes: 8

Views: 5140

Answers (1)

Fogmeister
Fogmeister

Reputation: 77641

There are two possible answer for this.

NSNotificationCenter is used to post notifications within the app itself. Say for instance you want several classes all to receive information that something has happened (or something) then you would use this. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html

If you mean Remote Notifications i.e. push notifications that you receive from Apple then the AppDelegate receives these in a couple of its methods...

https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786-CH3-SW16

Edit: It's not possible between apps. See comments.

Upvotes: 6

Related Questions