Search code examples
androidfacebook-graph-apiresponsefacebook-android-sdk

Response code 200 from facebook


I'm developing new android app which uses facebook sdk. I want to fetch users friends list, I'm doing it like that:

Request request = Request.newMyFriendsRequest(
                        Session.getActiveSession(),
                        new Request.GraphUserListCallback() {
                            public void onCompleted(List<GraphUser> paramAnonymousList,
                                    Response paramAnonymousResponse) {
                                Toast.makeText(getApplicationContext(),
                                        paramAnonymousList.toString(),
                                        Toast.LENGTH_SHORT).show();
                                Log.e(TAG, paramAnonymousList.toString()
                                        + paramAnonymousResponse.toString());
                            }
                        });
                request.executeAsync();

However when I run app I'm getting something like that:

GraphObjectList{itemType=GraphUser, state=[]}{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache:false}

I tried to run this code inside app which is not in development mode and it's working fine - i'm able to fetch user's data. What can be the cause of response code 200. According to that: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0 response code 200 belong to facebook permission errors. But to fetch user's friends list I don't have to provide any specific permissions, so what can be the cause of this response?

Thanks in advance


Solution

  • HTTP 200 means that your request is OK.

    The real issue is Facebook API v2.0. Apps cannot retrieve the full list of friends for a user, only friends already using the application. Even if you application is still in v1.0, users who first logged in after May 1st are getting v2.0 behaviour.

    Reference: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/friends

    Cheers!