How to get friends of facebook users and friends profile of friends using api v2.0 graph?

Facebook recently updated its api schedule to version 2.0 recently (April 30, 2014). What is the standard api call for getting facebook friends and their profile photos? (me / friends does not work, since I want all friends not friends who use the application)

+1
source share
3 answers
    Next code will provide the taggable_friends with Url pictures at wanted sizes.

Session session = Session.getActiveSession();
    Bundle params = new Bundle();
    params.putString("fields", "picture.width(" + size.x + ").height(" + size.y + ")");
    Request request = new Request(session, "/me/taggable_friends", params, HttpMethod.GET, new Request.Callback() {
        public void onCompleted(Response response) {


        }
    });
    Request.executeBatchAsync(request);
+1
source

In version 2.0, the / me / friends API charts use only user friends who are also logged into the application.

-, , /me/taggable_friends /me/invitable_friends.

: Facebook Graph Api v2.0 + -/me/friends , : facebook Graph API v.2.0

+3

Organize everyone, but this information is not.

Here is how you can get your taggable_friends Facebook user profile (great too!)

 [FBRequestConnection startWithGraphPath:@"/me/taggable_friends?fields=id,name,picture.type(large)"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          ) {
                          NSArray* friends = [result objectForKey:@"data"];
                          NSLog(@"Found: %i friends", friends.count);
                         for (NSDictionary<FBGraphUser>* friend in friends) {



                             NSDictionary *pictureData = [[friend objectForKey:@"picture"] objectForKey:@"data"];

                             NSString *imageUrl = [pictureData objectForKey:@"url"];

                             NSLog(@"Facebook profile image url %@", imageUrl);



                          }




                      }];

This returns all Facebook friends and analyzes each friend for an url image. You can parse the "friend" node for the taggable link (only works if you tag a friend from the application) and their username.

+2
source

All Articles