简体   繁体   English

如何在Android中使用Phonegap拨打自定义电话号码?

[英]How to dial a custom phone number using Phonegap in Android?

I'm writing an app using phonegap. 我正在使用phonegap编写应用程序。 I can open the native android dialer using: onclick="document.location='tel:0123456789'" . 我可以使用以下代码打开本机android拨号器:onclick =“ document.location ='tel:0123456789'”。 But i wish to open it with predefined number which i enter as an input. 但是我想用我输入的预定义数字打开它。 I'm receiving the desirable number as an text input like this: 我收到的期望数字是这样的文本输入:

function AddToScreen(a){
    document.getElementById('number_input').value+=a;
}

But i can't get the dialer to open with my input number. 但是我无法使用我的输入号码打开拨号器。

How can i get it to work? 我如何使它工作? Thanks. 谢谢。

Once you have the complete number you want to dial all you need to do is call: 有了完整的号码后,您只需拨打以下电话即可拨打:

document.location='tel:' + numberYouWantToDial;

Looks like you are most of the way there. 看来您已到达那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM