我们如何检测iphone应用程序中的呼叫中断? [英] How can we detect call interruption in our iphone application?

查看:114
本文介绍了我们如何检测iphone应用程序中的呼叫中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检测应用程序中的来电中断。当应用程序处于活动状态并且有任何来电或短信时,我的应用程序会获取主叫号码,以防电话和短信的所有详细信息。我想将这些存储在我的应用程序中。

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 Framework
您可以使用CTCall类获取有关调用状态的信息。 CTCallCenter允许您注册呼叫事件状态更改,但您的应用程序需要处于运行状态。当您的应用程序移动到后台时,您可能需要请求最长的后台时间(我猜是10分钟)。这些api仅适用于iOS 4.0及更高版本。你可以根据需要使用它们。

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;

这篇关于我们如何检测iphone应用程序中的呼叫中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆