6

I wrote a SMS app, showing the contact photos of my contacts in the overview.

Getting "normal" photos is no problem:

Uri cu = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
final InputStream input = Contacts.openContactPhotoInputStream(getContext().getContentResolver(), cu);
return BitmapFactory.decodeStream(input);

The problem is: contact photos provided by e.g. facebook are not there, how can I also get these "external" photos?

kelunik
  • 6,750
  • 2
  • 41
  • 70
  • this was answered here I think: http://stackoverflow.com/questions/3709607 – AndyBeans Jul 10 '13 at 17:58
  • hm. the [linked answer](http://stackoverflow.com/questions/3845570/get-contacts-photo-which-are-synced-with-facebook-for-android/4506152#4506152) there says I need the facebook api. I dont want to add the internet permission. – kelunik Jul 10 '13 at 18:08
  • Well you have to use the API since you are requesting photos from Facebook. One possible workaround would be to read cashed images of users friends from facebook app folder, but you can't be sure that newer versions of Facebook app will use the same folder. – Igor Čordaš Jul 12 '13 at 09:56
  • Not true. Something is going on with the facebook syncadapter. It seems to allow access to android but not to third party apps. This is a very annoying. Google is not manually downloading the photos from facebook. It is the job of the syncadapter. I am also running into this problem and the only solutions are installing different sync adapters for facebook and disabling the one in the facebook app. – nickmartens1980 Jul 12 '13 at 11:41

1 Answers1

0

I have done a lot of research on this topic. I seems that facebook has put some permissions in place that only allows access by several system apps and no 3rd party apps.

see for example this link: https://groups.google.com/forum/#!topic/android-developers/lREN16Hh4LQ

I also tried to decode the AndroidManifest.xml file from the facebook app, but even adding the permissions they use internally did not grant me access.

Users can install their own sync tools (available in the play store) to sync the contact with facebook. This works great. I can load the profile images on devices with such tools installed.

Personally I am a bit disappointed that facebook would restrict such access. They should have added a custom permission for this.

nickmartens1980
  • 1,593
  • 13
  • 23