Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

enisn/Xamarin.Forms.Contacts

Repository files navigation

Obsolete

This library is obsolete and doesn't target newer versions of Android & iOS.

I strongly recommend to use Xamarin.Essentials to read contacts.


Xamarin.Forms.Contacts

Read Contacts Data on iOS and Android

Easy usage in Portable Project:

var contacts = await Plugin.ContactService.CrossContactService.Current.GetContactListAsync();

You can generate ObservableCollection like that:

var contacts = await Plugin.ContactService.CrossContactService.Current.GetContactListAsync();

ObservableCollection<Contact> = new ObservableCollection<Contact>(contacts);

You can use filter like that:

var contacts = await Plugin.ContactService.CrossContactService.Current.GetContactListAsync(x=>x.Emails.Count > 0);

DO NOT FORGET ADD THIS PERMISSIONS:

ANDROID

READ_CONTACTS

iOS

If you don't have mac connection you should Right Click the Info.plist and Open With XML editor. Add this key into

	<key>NSContactsUsageDescription</key>
	<string>We need contact permission to do ...</string>