问题描述
我需要在我的应用程序中检测来电中断.当应用程序处于活动状态并且有任何来电或短信时,我的应用程序会获取呼叫号码以防通话,并获取所有详细信息以防短信.我想将这些存储在我的应用程序中.
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.
这是否可以在我们的 iPhone 应用程序中检测到通话中断和来电短信提醒?
Is this possible to detect Call interruption and incoming SMS alert in our iPhone application?
推荐答案
你将不得不使用 CoreTelephony 框架您可以使用 CTCall 类获取有关调用状态的信息.CTCallCenter 允许您注册呼叫事件状态更改,但您的应用程序需要处于运行状态.当您的应用程序移动到后台时,您可能需要请求最长后台时间(我猜是 10 分钟).这些 api 仅在 iOS 4.0 及更高版本中可用.您可以根据需要使用这些.
You will have to use CoreTelephony FrameworkYou 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;
这篇关于我们如何在我们的 iphone 应用程序中检测到通话中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!