10

Is there a way to initiate a phone call within an application using PhoneGap?

I know it's possible to use tel: hyperlinks to invoke the dialer, but this means that the application is paused. I'm trying to get this to work from within the application.

Any ideas?

Eliran Malka
  • 15,821
  • 6
  • 77
  • 100
Nick
  • 1,269
  • 5
  • 31
  • 45
  • 3
    I think you can make a dialer application inside your application. http://stackoverflow.com/questions/10303138/how-to-make-my-own-custom-dialer-in-an-android-phone – AnhSirk Dasarp May 19 '13 at 11:18

2 Answers2

2

You can use the CallNumber cordova plugin (call-number on npm) to make the actual call.

To keep running in the background (when your app is paused due the dialer taking over), there is cordova-plugin-background-mode. As your app will keep running, you can use the success callback passed to the CallNumber API to do stuff when the phone-call has succeeded.

Eliran Malka
  • 15,821
  • 6
  • 77
  • 100
0

PhoneGap/Cordova does not have a JS Function to be able to do what you desire. For Android this requires a special Intent, for iOS it is not possible.

You will need to create a custom Cordova/PhoneGap plugin using this guide. https://cordova.apache.org/docs/en/4.0.0/guide/hybrid/plugins/

To achieve the same resolution as this related question. How to make a phone call in android and come back to my activity when the call is done?

Community
  • 1
  • 1
Chris Timberlake
  • 490
  • 4
  • 16