2

I'm doing some evaluation of programs and frameworks to build cross-platform apps.

Now, i am just trying to load the contacts of the device with Xamarin.Mobile.

I found this guide: http://components.xamarin.com/view/xamarin.mobile but when I enter var book = new Xamarin.Contacts.AddressBook(); Visual Studio shows the error:

'Xamarin.Contacts.AddressBook' does not contain a constructor that takes 0 arguments

All other recipes or guides I found on the Xamarin website are specific for Android or iOS.

Does anyone knows how can I read the contacts with Xamarin.Mobile cross-platform? Or maybe someone knows my mistake?

Thanks

T. Ne
  • 21
  • 3
  • Are you doing this is an Android project, an iOS project, or a Forms PCL project? – Jason Nov 23 '15 at 17:10
  • I created a cross-platform project in VS. – T. Ne Nov 23 '15 at 17:12
  • 1
    I don't believe the Mobile component will work in a Forms PCL (which is presumably what you are using). Try using https://www.nuget.org/packages/Xam.Plugin.Contacts/ instead – Jason Nov 23 '15 at 17:15

1 Answers1

2

The suggestion above just didn't have enough context:

You can take a look of an example here : https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Contacts, which an abstraction on top of Xamarin.Mobile to enable you to access the contacts from shared code. It is still in alpha, but work looking at and is available on NuGet.

Else you could use a shared project instead of a PCL and access Xamarin.Mobile.

JamesMontemagno
  • 3,782
  • 1
  • 12
  • 13