Initiate A Call By Clicking Button On Ionic App
i was using a href='tel:+1-1800-555-5555 ' Call me' to call , but it is not initiating the call directly rather than putting the number in the box / asking for confirmation ..can i
Solution 1:
You need to put this in your config.xml
file for the href tel:phonenumber
to work
<access origin="tel:*" launch-external="yes" />
Solution 2:
Using a href="tel:+1-1800-555-5555 " will not work as you want, add this plugin to your project by running command
cordova plugin add https://github.com/Rohfosho/CordovaCallNumberPlugin.git
and in your project use this line to make call
window.plugins.CallNumber.callNumber(onSuccess, onError, number);
onSuccess
and onError
are callback functions, so declare them also.
Note: If you have skype installed, it will ask you to either make call from skype or direct phone. Otherwise it will directly start call.
Full JS Code:
$scope.CallNumber = function(){
var number = '18002005555' ;
window.plugins.CallNumber.callNumber(function(){
//success logic goes here
}, function(){
//error logic goes here
}, number)
};
Post a Comment for "Initiate A Call By Clicking Button On Ionic App"