How do I make a phone call on the iPhone?
In this lesson we will look at how to place a call from a LiveCode app that is running on a network enabled device.
Create a basic stack with a field for the phone number and a button to send
Add the following code to the 'call' button
Add this code to the call button
launch url "tel:" && field "number"
put the result into field "number"
The 'launch URL' functionality found in rev has been extended to interface directly with the iPhone. To start a telephone call on the iPhone we simply pass the following string to the 'launch URL' command:
tel: [Phone number]
So, to make a call to the RunRev support line you would use the following:
Our final line of code would look like this:
launch url "tel:+448452198923"
In this example we are letting the user enter the phone number into the field we dragged onto our stack. We build the call string and pass it to the launch command. The second line of code simply puts the result of our call into the same field. If the string passed to launch command is incorrect you will see a "no association" message appear in the field.