Hi Stephan, On Android, there are two types of contact ID: the individual contact ID, and the lookup key. Android gives you the option of looking at aggregated contacts (that is, merged contact details from multiple accounts), or individual contacts. The ID that you are using in your original example is the individual ID, but you have PreferContactAggregation set to true, which (as per the docs: http://betaapi.xamarin.com/?link=M%3aXamarin.Contacts.AddressBook.Load(System.String) ), means that the ID you're passing should be a lookup key (which is what you're retrieving in your second example). Your original example will work if PreferContactAggregation is false, or your second example is just as valid if you'd rather look at aggregates.
Hope that helps. On Tue, Jul 24, 2012 at 4:07 AM, Stephan Steiner <stephan.stei...@gmail.com>wrote: > Yup it does - found that out during debugging (the app would initially just > crash). > In fact I managed to reverse engineer the issue - I just went searching for > a given email over the entire address book, then searched for it using the > traditional approach, and compared ids. > > While data.Data.LastPathSegment is the proper id for executing > ManagedQuery, > it is wrong for the Xamarin.Mobile API (at least in the Android version / > Phone model I'm using - Galaxy S3 running on 4.0.4). > > When I set id as follows, it works: > > string[] pathElements = data.Data.EncodedPath.Split(new > char[] { '/' }); > id = pathElements[pathElements.Length - 2]; > > I haven't tested on the emulator yet (no contacts available and I'm too > lazy > to type them up - plus even the x86 emulator is slower than the S3) and my > Galaxy Nexus is on 4.1 so I'm still waiting for an adapted MonoDroid - so > the S3 is all I have for now. > > > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/Contact-woes-tp5710996p5711009.html > Sent from the Mono for Android mailing list archive at Nabble.com. > _______________________________________________ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid >
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid