Xamarin.Forms.Contacts icon indicating copy to clipboard operation
Xamarin.Forms.Contacts copied to clipboard

How to load the PhotoUri ?

Open mcferdev opened this issue 6 years ago • 6 comments

For instance, on Android that I am testing now, I got the result content://com.android.contacts/contacts/120

How to show this image ?

mcferdev avatar Oct 05 '18 16:10 mcferdev

For instance, on Android that I am testing now, I got the result content://com.android.contacts/contacts/120

How to show this image ?

did u resolve it? because I need help too.

andyvasilevich avatar Nov 20 '18 18:11 andyvasilevich

No, I didn´t !

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Livre de vírus. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail. <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Em ter, 20 de nov de 2018 às 16:51, Andy [email protected] escreveu:

For instance, on Android that I am testing now, I got the result content://com.android.contacts/contacts/120

How to show this image ?

did u resolve it? because I need help too.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/enisn/Xamarin.Forms.Contacts/issues/9#issuecomment-440388832, or mute the thread https://github.com/notifications/unsubscribe-auth/AQiRLIaRihcxbbnn_Qb5_E9Gl3EXIpjMks5uxE8YgaJpZM4XKhWr .

--

Atenciosamente,

Marcelo Couto Fernandes Desenvolvedor Mobile iOS, Android e WinPhone

mcferdev avatar Nov 23 '18 01:11 mcferdev

Photo uri is empty

gaocan1992 avatar Jan 29 '19 23:01 gaocan1992

Update: In Android I can get photo uri, but in iOS It is empty.

gaocan1992 avatar Jan 29 '19 23:01 gaocan1992

Looks like on iOS it uses CNContact which doesn't contain PhotoUri. CNContact has ThumbnailImageData and ImageData which are raw data. Here: https://github.com/enisn/Xamarin.Forms.Contacts/blob/master/Plugin/ContactService/Shared/Contact.cs We may need to add other properties in Contact class to store raw data for iOS. https://github.com/enisn/Xamarin.Forms.Contacts/blob/master/Plugin/ContactService/Platforms/iOS/ContactServiceImplementation.cs Also read these raw data from CNContact object and add it into Contact object.

gaocan1992 avatar Jan 31 '19 01:01 gaocan1992

I think the answer @marcelocferdeveloper and @andyvasilevich are looking for is:

var u = Android.Net.Uri.Parse(uri); // e.g. content://com.android.contacts/contacts/120
img.Source = ImageSource.FromStream(() => Android.App.Application.Context.ContentResolver.OpenInputStream(u));

I'm still working on iOS, but I appreciate @gaocan1992 's last comment

eliotg avatar Dec 18 '19 22:12 eliotg