问题
Please can you tell me how to handle session when a call is received.
Actually I'm playing with an online radio station and I want to resume that after call has ended.
回答1:
To add core telephony notification to your program, include the following code and compile linking to the Core Telephony framework. This code adds your program as a registered observer.
id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(ct, NULL, callback, NULL, NULL, CFNotificationSuspensionBehaviorHold);
To monitor the incoming notifications, you need to build the callback routine you supplied as an argument to the add observer call:
static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{ ... }
For more plz read Programmatically Handling iPhone interruptions
来源:https://stackoverflow.com/questions/5416330/how-to-handle-session-when-a-call-is-received