I create app to Facebook with facebook-android-sdk:4.1.0
How to get all photo of logged in User?
I need to load user all photo
I use this code
I read this
I have to use Graph API
/* make the API call */
new Request(
session,
"/{photo-id}",
null,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
please help please explain
答案 0 :(得分:3)
You can get everyone's Facebook profile picture using below.
You just call http://graph.facebook.com/USERNAME_OR_USERID/picture?type=large. This URL redirects you to image URL.
extention onto my answer:
how do I get the entire album?
You need https://graph.facebook.com/[uid]/albums?access_token=[AUTH_TOKEN] to get JSON array of all the albums of a user.
You will get three important things from here id - album id, name - album name, and type - album type.
What permissions do I need?
The permission required is user_photos see here
What is the best way to get ALL profile pictures from a given user? Profile Pictures are under "Profile Pictures" album. To get to profile album, you need to look into albums array (as mentioned previously), iterate through the JSON result-set, until you get an album with name = Profile Pictures and type = profile. Get id of this object. This is the profile pictures album.
Now you can access it similar to you access any other album. That is, https://graph.facebook.com/[ALBUM_ID]/photos?access_token=[AUTH_TOKEN] this will list all the profile pictures of the user ever uploaded.
Hope this helps.