1

I am making a call to fb to retrieve friend list from android app. I have got a list of around 35 people on the app all who have given "user_friends" permission. But I am not able to retrieve more than 25 friends whatever I do.

Following is my code:

Session activeSession = Session.getActiveSession();
        if(activeSession.getState().isOpened()){
            Request friendRequest = Request.newMyFriendsRequest(activeSession, 
                new GraphUserListCallback(){
                    @Override
                    public void onCompleted(List<GraphUser> users,
                            Response response) {
                        mUsers = users;
                        if(mUsers==null)
                        {
                        return;
                        }


                    String[] userids = new String[mUsers.size()];

                    int i = 0;
                    for(GraphUser user : mUsers){
                    userids[i] = user.getId();
                    i++;
                    }
                  .... more code

What am I missing?

1 Answers1

1

You have to implement paging: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging

Alternatively, you can try adding a limit parameter to the API call: /me/friends?limit=50

I am no Android programmer, but i´ve found this in another thread, it may work:

Bundle params = new Bundle();
params.putString("limit", "50");
friendRequest.setParameters(params);

Source: Get friend list facebook 3.0

Community
  • 1
  • 1
andyrandy
  • 72,880
  • 8
  • 113
  • 130