0

I'm making an app using apparchitect and I would like to know how to use JavaScript to call a number. I have tried using different ones already uploaded to no avail. Is it possible to allow a user to (after pushing a button) call a specific number?

In the simplified app maker I can use javascript if they do not have the function I want. This is for an iphone app. Please help this app is really important. Thank you.

Alicia Sabatino
  • 57
  • 1
  • 2
  • 10
  • Browsers do not operate like telephones, so you need a service (API) to call when you click that button. Usually you'll pay for a service like this, or you implement your own with a logic board that supports phone cards. Check https://www.twilio.com/ – bitoiu Jan 26 '15 at 18:13
  • http://stackoverflow.com/questions/11032489/onclick-call-phone-number – Rick S Jan 26 '15 at 18:14

2 Answers2

0

twilio nodejs library. It's incredibly easy.

1.) Make an account with twilio.

2.) Hook up your button with this code:

// 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);
});

In fact, I feel like being really nice, so I just uploaded a repository to github which does exactly what you are asking. It uses the Meteor framework. To run it, clone the repo, navigate to the folder in your command line and simple type "meteor" into the command prompt. The site will be running in your browser at localhost3000.

Goodword
  • 1,565
  • 19
  • 27
0

The easiest answer for your iPhone app is to include the following HTML (as seen from this answer:

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

Tapping the "tap to call" text on your phone will activate the link and send a message to your app to launch to the provided URL. As long as your app is responding to your webview properly and to the OS, everything should work without JavaScript:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: activatedURLString]]
Community
  • 1
  • 1
Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51