How can I run my iPhone application when I decline an incoming call?
How can I run my application when the user declines the incoming call, using the iP开发者_如何学Pythonhone SDK?
OK, just did some digging around in the SDK. The closest thing I found is the CoreTelephony framework (new in iOS 4.0). It has the ability to specify a block callback so you can be notified about the call changes. Something like:
CTCallCenter *callCenter = [[CTCallCenter alloc] init];
[callCenter setCallEventHandler:^(CTCall *call) {
NSLog(@"state changed on call: %@", call);
}];
You can check the callState
of that CTCall
object to see whether it's disconnected or what. I don't know how you'd figure out offhand that the call was declined, but you can at least know when calls happen/change state. If your app is in the background, then when you're foregrounded again, you'll get a single coalesced callback for each call. If your app is not running at all, then I have no idea what happens when the app starts.
This is where I'd start looking, anyway.
精彩评论