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());

    }
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top