Ensuring that your device can make phone calls
With all of the technical wizardry and touchscreen goodness that are now packed into modern smartphones, it's easy to forget that their primary function is still that of a telephone—being capable of making and receiving voice calls. There may be times, however, when the user's device is not capable of performing a call for whatever reason (poor network service; lack of call functionality, that is, an iPod touch user; and so on).
In this recipe, we will attempt to make a phone call, first checking the device's capabilities, and throwing an error message when a phone call is not possible.
The complete source code for this recipe can be found in the /Chapter 11/Recipe 5
folder.
How to do it…
Open your app.js
file, remove any existing code, and add the following:
// create root window var win1 = Ti.UI.createWindow({ title: 'Tab 1', backgroundColor: '#fff' }); //create the textfield number entry to dial var txtNumber = Ti.UI.createTextField(...