Xamarin.Essentials: Contacts

The Contacts class lets a user pick a contact and retrieve information about it.

Pre-release API

Get started

To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.

To access the Contacts functionality the following platform specific setup is required.

The ReadContacts permission is required and must be configured in the Android project. This can be added in the following ways:

Open the AssemblyInfo.cs file under the Properties folder and add:

[assembly: UsesPermission(Android.Manifest.Permission.ReadContacts)]

OR Update Android Manifest:

Open the AndroidManifest.xml file under the Properties folder and add the following inside of the manifest node.

<uses-permission android:name="android.permission.READ_CONTACTS" /> />

Or right click on the Android project and open the project's properties. Under Android Manifest find the Required permissions: area and check this permission. This will automatically update the AndroidManifest.xml file.

Picking a Contact

By calling Contacts.PickContactAsync() the contact dialog will appear and allow the user to receive information about the user.

    var contact = await Contacts.PickContactAsync();

    if(contact == null)

    var name = contact.Name;
    var contactType = contact.ContactType; // Unknown, Personal, Work
    var numbers = contact.Numbers; // List of phone numbers
    var emails = contact.Emails; // List of email addresses 
catch (Exception ex)
    // Handle exception here.