Is there NSNotification for phone call status

Is there an NSNotification that we can observe when the device is on / off?

+4
source share
2 answers

NotificationCenter does not send any notifications about this, but check out the CTCallCenter class introduced in iOS 4. It has a callEventHandler property that you can assign to a code block and receives a call with information about the call status.

There is a limitation that the handler receives a call only when your application is in the foreground (or removed from the foreground when a call arrives), but it tells you whether the user is CTCallStateDialing ( CTCallStateDialing ), receiving a call ( CTCallStateIncoming ), answer / connection ( CTCallStateConnecting ) or hang on call ( CTCallStateDisconnected ).

+5
source

I don’t know what I know, but if the problem is that you want to know about the status bar change, you can watch UIApplicationWillChangeStatusBarFrameNotification (as described in the bottom of the UIApplication Documentation ) and get a new rectangle from the corresponding user information whenever the change occurs.

0
source

All Articles