How can we detect call interruption in our iphone

2019-01-27 12:02发布

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?

3条回答
甜甜的少女心
2楼-- · 2019-01-27 12:27

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;
查看更多
Viruses.
3楼-- · 2019-01-27 12:31

ApplicationWillResignActive delegate method call in this case....For More info Read this

查看更多
闹够了就滚
4楼-- · 2019-01-27 12:32

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.

查看更多
登录 后发表回答