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.
留言
張貼留言