I have developed andoid app successfully.In that i have used phonecall trapper to identify the incoming call.As far as I know this plugin supports only in android. What method i should use in ios and windows phones?
-
If you develop toy app, and you know it only support android, you should download Xcode and try in OS – Lester Vargas Mar 05 '16 at 04:14
-
1In iOS you can receive notification that your app is being interrupted by an incoming call if your app is in the foreground but you can't find out anything about the call or prevent the call from coming in – Paulw11 Mar 05 '16 at 05:54
-
i am trying to pause music (which is to be playing with my app) while the incoming call is coming.. is that possible? – Albert Mar 09 '16 at 12:08
-
Hey @Albert I think It should be built in feature for iOS or any phone OS. Is that the case your music is till playing on incoming call? – Avinash Jadhav Mar 22 '16 at 15:13
-
@Albert , in the native development the method is available which tells when app goes in foreground (like call or some other events) , for the Cordova development you can make plugin for the iOS to implement that functionality – HardikDG Mar 22 '16 at 17:49
-
Yeh, actually plugins are not available to get call details. Theses are some limitation of PhoneGap. Even if the plugins are available don't know how much apple will support or don't will get approved by app store even if you managed to access these information. – Avinash Jadhav Mar 23 '16 at 13:44
3 Answers
In iOS,you can't access such details.Every app works in a sandbox and access outside of this sandbox is highly limited.So it's not possible to track the incoming calls.
Your IOS application cannot get call details about phone calls.
As a phonegap application you are limited to the solutions mentioned in this duplicate question to what you are asking
Quote:
All you can do is listen for the pause event.
document.addEventListener("pause", yourCallbackFunction, false);
This event will be fired when there is an incoming call or starting a call.
or you could look into the phone listener plugin and try to write it for iOS https://github.com/devgeeks/PhoneListener
As a native app you would be able to be notified when a call is received, ended, and connected using this answer from stop playing music when incoming call received in iphone
Quote:
Use this following notification to find the call status and you can stop the player. Add 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];
Another good answer related to Native apps would be to check out is this one from How to detect call incoming programmatically which has a more expanded example.

- 1
- 1

- 3,551
- 21
- 36
Please give a try to following plugin
https://github.com/renanoliveira/cordova-phone-call-trap
Hope this will work. If not then can do is listen for the pause event.
document.addEventListener("pause", yourCallbackFunction, false);
This event will be fired when there is an incoming call or starting a call.
or you could look into the phone listener plugin and try to write it for iOS.
or read details on a similar issue here How to detect with PhoneGap on iOS if call is made or not

- 1
- 1

- 1,438
- 13
- 21
-
Phone Call Trap is only for android... But this fork isn't trying to put it on iOS : https://github.com/ElieSauveterre/cordova-phone-call-trap – davidbonachera May 04 '16 at 16:01