Make phone call with Cordova for Hybrid application

Make phone call with Cordova for Hybrid application


Method 1: tel: protocol (open a native dialer)

With regular HTML hyperlink element:
Call me

or using angularjs directive:
Call me

Add the explicit whitelist permission on config.xml

<access origin="tel:*" launch-external="yes" /> <access origin="mailto:*" launch-external="yes" />

Cordova Whitelist Guide

Method 2: Cordova Plugin

CordovaCallNumberPlugin

Call a number directly from your cordova application.
Install the plugin using:
cordova plugin add https://github.com/Rohfosho/CordovaCallNumberPlugin.git

Use the plugin in your JS file:
window.plugins.CallNumber.callNumber(onSuccess, onError, number);
Make sure to create onSuccess and onError call back functions.






留言

這個網誌中的熱門文章

Disable ionic's sidemenu content drag to toggle menu

java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl$Parser

Multiple writable mappings exist for the field. Only one may be defined as writable, all others must be specified read-only.