Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

id title brief sdk
Dialing the Phone by URI
iOS apps utilize uniform resource locators (URLs), a form of uniform resource identifiers (URIs), to access schemes that integrate with system apps. The tel URL scheme launches the Phone app and dials the number contained in the NSUrl.


Dial By URI

  1. First, we must generate a NSUrl from the string "tel:" appended to the number we want to dial. For this example, lets place the following code in the CallButton TouchUpInside event handler:
``` var url = new NSUrl ("tel:" + PhoneTextField.Text); ```
  1. To create a scheme to access the Phone app, we would place the following code after we generate our NSUrl variable:
``` UIApplication.SharedApplication.OpenUrl (url); ```
  1. Since emulators don't support the system Phone app, we should instead attempt to create our scheme inside the following conditional statement:
``` if (!UIApplication.SharedApplication.OpenUrl (url)) { var av = new UIAlertView ("Not supported", "Scheme 'tel:' is not supported on this device", null, "OK", null); av.Show (); }; ``` If the scheme cannot be generated, we alert the user using a `UIAlertView`.