I need to detect incoming call interruption in my application. When application is in active state and there is any incoming call or SMS, my application grab the calling number in case if call and all details in case of SMS. I want to store these in my application.
Is this possible to detect Call interruption and incoming SMS alert in our iPhone application?
You will have to use CoreTelephony Framework
You can get information about the state of the call by using the CTCall class. the CTCallCenter allows you to register for call event state changes but your app needs to be in running state.You may want to request the maximum backgrounding time ( 10 minutes I guess) when your application is moved to the background. These api's are only available in iOS 4.0 and later. you can use these as required.
extern NSString const *CTCallStateDialing;
extern NSString const *CTCallStateIncoming;
extern NSString const *CTCallStateConnected;
extern NSString const *CTCallStateDisconnected;
ApplicationWillResignActive delegate method call in this case....For More info Read this
Your app delegate will receive the -applicationDidResignActive
message and your app can listen for the UIApplicationDidResignActiveNotification
. These will be received when your app is interrupted by a call as well as in other cases where the app is interrupted, such as when the screen locks or the user presses the lock button.