iOS:在接听电话时显示提醒? [英] iOS: showing an alert when getting a call?

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

问题描述

我希望在收到电话时发出本地通知(并显示提醒) - 这可能吗?呼叫事件是否可以启动应用程序或触发通知?

I would like a local notification to be fired when a call is received (and to show an alert) - is this possible? Can a call event get an app to launch or a notification to be fired?

skype是如何解雇的?使用推送通知?

How is skype fired? With push notifications?

谢谢

推荐答案

如果您的应用程序正在运行在呼叫到位时,请查看 CoreTelephony框架 CTCall 类提供有关呼叫状态的信息。我自己没有使用它,但你可能会发现它很有用。

If your application is running while a call is in place check out the CoreTelephony Framework. The CTCall class provides information about the call state. I have not used this myself but you may find it useful.

extern NSString const *CTCallStateDialing;
extern NSString const *CTCallStateIncoming;
extern NSString const *CTCallStateConnected;
extern NSString const *CTCallStateDisconnected;

修改:

CTCallCenter 允许您注册呼叫事件状态更改。正如我之前所说,你的应用程序需要运行才能知道某些内容已经发生了变化。当您的应用程序移动到后台时,您可能想要请求最长的后台时间(我认为现在是10分钟)。这些api仅适用于iOS 4.0及更高版本。

The CTCallCenter allows you to register for call event state changes. As I said before your application will need to be running to know that something has changed. You may want to request the maximum backgrounding time (I think it is 10 minutes now) when your application is moved to the background. These api's are only available in iOS 4.0 and later.

这篇关于iOS:在接听电话时显示提醒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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