In my android application I download album list of specified friend of user.
I've got permission as follows:friends_about_me, friends_photo_video_tags, friends_photos, user_photos.
For some friends it works perfectly and I am able to download full list and all photos. But for some it returns empty array. Is this a case of friend privacy policy or this is FB bug?
If i try to view this friend albums via FB page or via FB android app it works fine.
Edit: I did get user album id from URL from FB page and paste it to GRAPH API explorer and it returned false to me.
Question is: what to do to get album list and album photos?
Privacy Settings
(Currently) under Account > Privacy settings > Apps and Websites "Edit your settings"
, there is a way for users to set what information your app can access through their friends, regardless of what permissions their friends grant to the app.
If the person you are trying to see albums from has unchecked "My Photos", then they have to grant the app permission directly (described below). By default it is checked, and your app can access the user's photos. If the box is unchecked, then there is no way for your app to get their photos without them adding your app and giving you access.
With the changes that are being rolled out to facebook's privacy settings, these settings are likely to be moved, but hopefully the functionality will still be around.
Update 8/30 - My facebook account was just enabled with the changes referred to above. The dialog is the same, just under a different label: Account > Privacy Settings > Apps and Websites > How people bring your info to apps they use "Edit settings"
. Some of the text was updated and some options are slightly different, but otherwise the settings are the same.
Testing
Configure two accounts like so:
Account 1:
- Two groups for friends, one of which is called "restricted"
- Photo albums (except for 'Profile pics') set so that 'Friends only; except Restricted group' can see them. Profile pics is set to friends only.
- "My photos" unchecked in "Info accessible through friends"
- Very liberal permissions to app (
friends_about_me, friends_photo_video_tags, friends_photos, user_photos
among others)
Account 2:
- Friends with account 1
- Granted same permissions to app
By toggling privacy controls (checking/unchecking the checkbox in question, granting/revoking privileges for the app on Account 1, and adding/removing Account 2 to the "Restricted" group) on Account 1 and trying to access that account's photo albums, you will find that with the My Photos
checkbox in account 1:
- Checked
- Any app with the
friends_photos
permission used by Account 2 can see any photos visible to Account 2
- Unchecked
- Apps used by friends of Account 1 cannot access any photos, unless...
- UNLESS Account 1 has added your app and granted the
user_photos
permission. In this case the app has access to any albums visible to Account 2.
So the only way Account 2 can access Account 1's albums (/<userid>/albums
) with the "My photos" box unchecked is when Account 2 is not in the "restricted" group and Account 1 has the app enabled with the user_photos
permission. When Account 2 is restricted, the only album it can see is (as expected) the 'Profile pictures' one. When Account 1 either deletes the app or enables it without granting the user_photos
permissions, the /albums
connection returns an empty array.
So while it may seem like an error that you get an empty array back, it's actually completely deterministic and expected behavior. On top of that it's good from a user privacy standpoint that Facebook gives users control over this setting.
So how do you get their photos?
You don't. Or, you shouldn't, anyway. If they've taken the time to disable access to their photos through their friends, you should respect their privacy.
That said, it is technically still possible to log in to facebook.com as one of their friends and see the photos they've shared with their friends but not with their friends' apps. In theory you could write a web crawler that would automatically perform such a task, although it is against facebooks terms of service and you would be a Bad Person for doing so:
[3.2] You will not collect users' content or information, or otherwise access Facebook, using automated means (such as harvesting bots, robots, spiders, or scrapers) without our permission.
u should run a test,
create 2 facebook test profiles (or use friends account)
make one private and the other public and see the results
i would be willing to bet it is the privacy settings
if it works regardless of the privacy settings then maybe your making to many request simultaneously and getting getting dropped because of it.