接听电话时如何处理会话 [英] How to handle session when a call is received

查看:54
本文介绍了接听电话时如何处理会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请您告诉我如何在接到电话时处理会话.

Please can you tell me how to handle session when a call is received.

实际上,我正在和一个在线广播电台一起玩,我想在通话结束后恢复该状态.

Actually I'm playing with an online radio station and I want to resume that after call has ended.

推荐答案

要将核心电话通知添加到程序中,请包含以下代码并编译到Core Telephony框架的链接.这段代码会将您的程序添加为注册的观察者.

To add core telephony notification to your program, include the following code and compile linking to the Core Telephony framework. This code adds your program as a registered observer.

id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(ct, NULL, callback, NULL, NULL, CFNotificationSuspensionBehaviorHold);

要监视传入的通知,您需要构建作为添加给添加观察者调用的参数提供的回调例程:

To monitor the incoming notifications, you need to build the callback routine you supplied as an argument to the add observer call:

static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
 { ... }

有关更多请阅读以编程方式处理iPhone中断

这篇关于接听电话时如何处理会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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