如何使用phonegap检测ios和windows设备中的来电?

Alb*_*ert 6 windows iphone ios phonegap-plugins phonegap-build

我已经成功开发了andoid app.因为我使用了phonecall捕获器来识别来电.据我所知这个插件仅支持android.我应该在ios和windows手机中使用什么方法?

Tim*_*ner 0

您的 IOS 应用程序无法获取有关电话的详细信息


作为一个phonegap应用程序,您只能使用这个重复问题中提到的解决方案来解决您所问的问题

引用:

您所能做的就是监听暂停事件。

document.addEventListener("pause", yourCallbackFunction, false);

当有来电或开始通话时,将触发此事件。

或者你可以研究一下电话侦听器插件并尝试为 iOS 编写它https://github.com/devgeeks/PhoneListener


作为一个本机应用程序,您将能够在接到电话、结束电话连接电话时收到通知,使用此答案在 iphone 中收到来电时停止播放音乐。

引用:

使用以下通知查找通话状态,您可以停止播放器。添加CoreTelephony.framework

#import <CoreTelephony/CTCall.h>

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callReceived:) name:CTCallStateIncoming object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callEnded:) name:CTCallStateDisconnected object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callConnected:) name:CTCallStateConnected object:nil];
Run Code Online (Sandbox Code Playgroud)

与本机应用程序相关的另一个好答案是查看如何以编程方式检测来电,其中有一个更扩展的示例。