每次通话结束后在iOS中调用应用 [英] Invoking app in iOS after every phone call ends

查看:72
本文介绍了每次通话结束后在iOS中调用应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个应用程序,该应用程序应该在用户完成电话通话后立即显示出来(每个&每次).

I am trying to make an app, which should come into picture (each & every time) as soon as the user is done with his/her phone call.

用例:

我的应用"当前未运行.

"My app" is currently not running.

  1. 用户通过手机拨打电话.
  2. 通话完成后,我的应用"将启动/运行.
  3. 它应该收集有关上次通话的一些信息.
  4. 将其写入日志&结束..

我已经看到任务在后台运行,但是在每次通话后如何调用App.

I have seen tasks running in background foreground but how to invoke App after each phone call.

谢谢..

推荐答案

无法执行此操作.很简单,iOS还没有(基于)某些系统事件会触发您的应用程序的任何此类功能.

You cannot do this. Quite simply iOS does not (yet) have any such feature where your app would be triggered based on some system event.

但是您可以在运行应用程序时拨打电话时探索一些替代方法.

But you can explore some alternatives when a call comes when your app is running.

如果来电时您的应用正在运行

可能可以注册接收来自 UITelephony 的通知(使用 UINotificationCenter 调用).

It might be possible to sign up to receive notifications (using UINotificationCenter calls) from UITelephony.

但是,如果您在通话开始时正在积极使用应用程序,则通话结束后它将调用-(void)applicationWillEnterForeground .至于区分通话结束还是定期回电,我不知道.但这是一个开始.

However, if you're actively using your app when the phone call starts, it will call -(void)applicationWillEnterForeground when the call is finished. As for differentiating a phone call end versus just a regular return to phone call, I don't know. But it's a start.

如果在进行呼叫的同时您的应用程序正在运行 CTCall 类提供有关呼叫状态的信息.我自己没有使用过,但是您可能会发现它有用.

If your application is running while a call is in place CoreTelephony Framework provides call states. CTCall class provides information about the call states. 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;

这篇关于每次通话结束后在iOS中调用应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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