是否可以允许用户(按下按钮后)拨打特定号码?

时间:2015-01-26 18:08:23

标签: javascript ios iphone

我正在使用apparchitect创建一个应用程序,我想知道如何使用JavaScript来拨打号码。我尝试使用已上传的不同内容无济于事。是否可以允许用户(按下按钮后)拨打特定号码?

在简化的应用程序制作者中,如果他们没有我想要的功能,我可以使用javascript。这是一个iPhone应用程序。请帮助这个应用程序非常重要。谢谢。

2 个答案:

答案 0 :(得分:0)

twilio nodejs library。这非常容易。

1。)使用twilio创建一个帐户。

2。)使用以下代码连接按钮:

// Your accountSid and authToken from twilio.com/user/account go in between quotes
var accountSid = "";
var authToken = "";
var client = require('twilio')(accountSid, authToken);  // don't forget to install the twilio libary from npm

client.messages.create({
    body: "Jenny please?! I love you <3",
    to: "+14159352345",
    from: "+14158141829"
}, function(err, message) {
    process.stdout.write(message.sid);
});

事实上,我觉得自己真的很好,所以我只是uploaded a repository to github which does exactly what you are asking。它使用Meteor框架。要运行它,请克隆存储库,导航到命令行中的文件夹和简单类型&#34; meteor&#34;进入命令提示符。该站点将在您的浏览器中运行localhost3000。

答案 1 :(得分:0)

您的iPhone应用最简单的答案是包含以下HTML(从this answer看到:

<a href="tel:1300111222">tap to call</a>

点击&#34;点按以拨打&#34;手机上的文字会激活该链接并向您的应用发送消息以启动所提供的网址。只要您的应用正确响应您的webview和操作系统,一切都应该在没有JavaScript的情况下运行:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: activatedURLString]]