Is there an NSNotification we can observe for when the device is on/off the phone?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
NotificationCenterdoesn’t send out any notifications abou this, but take a look at theCTCallCenterclass introduced in iOS 4. It has acallEventHandlerproperty that you can assign a block of code to, and gets called with call state info.There is a limitation in that the handler only gets called when your app is in the foreground (or being taken out of the foreground when a call comes in), but it tells you if the user is dialing (
CTCallStateDialing), receiving a call (CTCallStateIncoming), answering/connecting (CTCallStateConnecting) or hanging up on a call (CTCallStateDisconnected).