Search code examples
androidioscordovakeypad

How to create a custom dialer using phonegap (Android and iOS)


I would like to create a phonegap application which is basically a dialer that dials a number, based on the number from phone contacts. (I would be having a logic in the application, which basically adds some additional numbers to the existing number from contacts).

I know that I can access the contacts using http://docs.phonegap.com/en/2.4.0/cordova_contacts_contacts.md.html#Contacts

But is there any plugin to dial a programmatic number, its available in android but I couldnt find one for iOS https://github.com/sialam/PhoneGap-2.7-Android-plugins-to-make-a-phone-call

in Android I can give the [phonenumber] in cordova.exec(null, null, "PhoneDialer", "call", [phoneNmber]);

Is there any plugin for iOS?


Solution

  • Hi @joel do the following changes

    1)Corresponding phone dialer.js https://gist.github.com/rahulinaction/2703b8c6f30f5daa1732

    2)Corresponding phonedialerh and m files https://gist.github.com/rahulinaction/9337f8dd5618955d4762 copy these files to your plugins folder inside CordovaLib.xcodeproj and add it to your CordovaLib.xcodeproj

    3)Then in your Cordova.plist create a string in the Plugins Dictionary with key name as phonedialer and value PhoneDialer.Or if you have a config.xml add this plugin name="phonedialer" value="PhoneDialer" inside plugins tag.

    4)Then you can call the following by this window.plugins.phoneDialer.dial(yourno)

    As for the latest phonegap i think the commandline feature is quite easy as you dont have to do individual setups for diff platforms.I dont know an alternative though.