Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 2.25 KB

File metadata and controls

51 lines (33 loc) · 2.25 KB
title description ms.date no-loc
Phone dialer
Learn how to open the phone dialer to a specific number, in .NET MAUI. The IPhoneDialer interface in the Microsoft.Maui.ApplicationModel.Communication namespace is used to open the phone dialer.
02/02/2023
Microsoft.Maui
Microsoft.Maui.ApplicationModel.Communication

Phone dialer

Browse sample. Browse the sample

This article describes how you can use the .NET Multi-platform App UI (.NET MAUI) xref:Microsoft.Maui.ApplicationModel.Communication.IPhoneDialer interface. This interface enables an application to open a phone number in the dialer.

The default implementation of the IPhoneDialer interface is available through the xref:Microsoft.Maui.ApplicationModel.Communication.PhoneDialer.Default?displayProperty=nameWithType property. Both the IPhoneDialer interface and PhoneDialer class are contained in the Microsoft.Maui.ApplicationModel.Communication namespace.

Get started

To access the phone dialer functionality, the following platform-specific setup is required.

If your project's Target Android version is set to Android 11 (R API 30) or higher, you must update your Android Manifest with queries that use Android's package visibility requirements.

In the Platforms/Android/AndroidManifest.xml file, add the following queries/intent nodes in the manifest node:

<queries>
  <intent>
    <action android:name="android.intent.action.DIAL" />
    <data android:scheme="tel"/>
  </intent>
</queries>

No setup is required.

No setup is required.


Open the phone dialer

The phone dialer functionality works by calling the xref:Microsoft.Maui.ApplicationModel.Communication.IPhoneDialer.Open%2A method with a phone number. When the phone dialer is opened, .NET MAUI will automatically attempt to format the number based on the country code, if specified.

:::code language="csharp" source="../snippets/shared_1/CommsPage.xaml.cs" id="phone_dial":::