Being able to launch the native dialer app or SMS app from the app you are building might be a very useful feature. For instance, the app you are building might display a list of restaurants in the area with a phone number. You want to be able to click the number and call the restaurant. This functionality can be easily done with calling the “tel:” or “sms:” and passing the needed values. Here is the simple Appery.io app that contains just a two buttons:
window.location.href = “sms:+375292771265?body=Hello from Appery.io!”;
Such code will open the SMS typing window with predefined text and phone number as following:
window.location.href = “tel:+375292771265”;
Clicking on that button will open the dialer with pre-populated phone number:
It is not possible to programmatically call or send SMS without opening the appropriate window due to the security reasons.
iOS has some nuances when dialer or sms window should be opened. Try to use such code for iOS platform:
Or for SMS:
window.open(‘sms:+375292771265?body=Hello from Appery.io!’, ‘_system’);
Please also note that these protocols (tel: and sms:) might work differently depending on OS/browser versions. On Android, you might get different functionally depending what app is selected for sending SMS messages.
Instead of using the native SMS app, a number of services such as AT&T and Twilio provide APIs to send SMS messages. Appery.io has plugins for AT&T and Twilio SMS API.