Phone dialer
This article describes how you can use the .NET Multi-platform App UI (.NET MAUI) 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 PhoneDialer.Default 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>
Open the phone dialer
The phone dialer functionality works by calling the Open 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.
if (PhoneDialer.Default.IsSupported)
PhoneDialer.Default.Open("000-000-0000");