Blog

How to dial a phone number from an app

On screens that display telephone numbers, we can open the dialler when the user clicks the number. This post walks through how to add this feature to an app

On mobile phones, the ability to open the phone dialler can be very convenient. The easiest way to accomplish this is to use the 'view phone' control on a form. Alternatively, we can call the Launch function and to construct a URL that follows the "tel:" convention.  

To demonstrate, we'll take an auto-generated app that's based on a table of clients. The schema of the table is shown beneath.
  
  
On the detail form, we click the edit fields link and we change the control type to 'view phone'.


How the app looks at runtime

Here's how the 'view phone' control looks at runtime. When the user clicks the number, the telephone dialler opens and is prepopulated with the number. The user can click the call button to connect the call.


How to dial a number outside of a form

Outside of a form, we can carry out the same task by calling the Launch function like so:
      
Launch("tel:07895658795")
  
The screenshot beneath shows how to apply this technique to the OnSelect property of a label.

A useful point to note is that if need to dial special numbers (such as the # or * symbols), we need to escape these symbols as described here:

Conclusion

On screens that show telephone numbers, we can open the telephone dialler and pre-populate it with a number either by using the 'view phone' control on a form, or by calling the Launch function