I am writing an app using PhoneGap and Jquery, in my app i have a panic button, onclick it should automatically call a predefined number. I’m managing to open the native android dialer but still i need the user to click again on send button to dial.
How can I make a direct call from the app?
You will need to write a plugin for this functionality. The first thing you will need to do is add the:
to your AndroidManifest.xml. This will allow you to dial a number skipping the Dialer app. A small bit of JavaScript code is required for the plugin interface:
Then you’ll need to write some Java code to do the phone call. You’ll need to create a new class that extends the Plugin class and write an execute method like this:
Whatever you call this class you’ll need to add a line in the res/xml/config.xml file so the PluginManager can create it.
and finally in your JavaScript code you’ll need to create they plugin and call it like this:
That should about do it.