[英]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 call directly , as if we click "Call Me" and the call gets started, i am using ionic + angular do i have to include cordova , have checked this articale but not much help: 我正在使用href =“tel:+ 1-1800-555-5555”给我打电话“但是它没有直接发起呼叫而不是把号码放在盒子里/要求确认..我可以直接打电话,就好像我们点击“呼叫我”并且呼叫开始,我使用离子+角度我必须包括cordova,检查了这个明确但没有太大的帮助:
http://rickluna.com/wp/2012/02/making-a-phone-call-from-within-phonegap-in-android-and-ios/ http://rickluna.com/wp/2012/02/making-a-phone-call-from-within-phonegap-in-android-and-ios/
Using a href="tel:+1-1800-555-5555 " will not work as you want, add this plugin to your project by running command 使用href =“tel:+ 1-1800-555-5555”将无法正常工作,通过运行命令将此插件添加到项目中
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. onSuccess
和onError
是回调函数,因此也声明它们。
Note : If you have skype installed, it will ask you to either make call from skype or direct phone. 注意 :如果您安装了Skype,它会要求您通过Skype或直接电话拨打电话。 Otherwise it will directly start call. 否则会直接开始通话。
Full JS Code: 完整的JS代码:
$scope.CallNumber = function(){
var number = '18002005555' ;
window.plugins.CallNumber.callNumber(function(){
//success logic goes here
}, function(){
//error logic goes here
}, number)
};
你需要把它放在你的config.xml
文件中,以便href tel:phonenumber
能够工作
<access origin="tel:*" launch-external="yes" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.