Question

This is the code that i used.I am only able to get the name and ids of the friends and no other details

    FacebookClient fb=new DefaultFacebookClient(ACCESS_TOKEN);  

    Connection<User> myFriends = fb.fetchConnection("me/friends", User.class);

    List<User> users=myFriends.getData();

    for(Iterator iterator=users.iterator();iterator.hasNext();)

    {
        User user=(User)iterator.next();

        System.out.println(user.getRelationshipStatus());

    }
Was it helpful?

Solution

Getting only the name and id is the expected result.

You can change it by specifying which fields you want to get back. In restfb it should be something like:

Connection<User> myFriends = fb.fetchConnection("me/friends", User.class, 
    Parameter.with("fields", "id,first_name,last_name,name,gender"));

Add anything else you need and have permission for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top