1

I am using the following login method to login

ParseFacebookUtils.logInWithReadPermissionsInBackground(this,
                Arrays.asList("user_status", "read_stream", "user_friends", "read_friendlists"), new LogInCallback() {
                    @Override
                    public void done(ParseUser parseUser, ParseException e) {
                        System.out.println("ParseUser: " + parseUser);
                        System.out.println("ParseException: " + e);
                        linkUser(parseUser);
                    }
                });

and using the following method to get my friend list, I need to retrieve all friends

GraphRequest request1 = GraphRequest.newMyFriendsRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONArrayCallback() {
            @Override
            public void onCompleted(JSONArray jsonArray, GraphResponse graphResponse) {
                Toast.makeText(HomeScreenActivity.this, "" + jsonArray.length(), Toast.LENGTH_SHORT).show();
            }
        });
        request1.executeAsync();

but the jsonArray is always empty, can anyone tell me what is wrong here ?

EDIT

I also get the following value in the Graph Response

{Response:  responseCode: 200, graphObject: {"summary":{"total_count":476},"data":[]}, error: null}
Amira Elsayed Ismail
  • 8,304
  • 26
  • 74
  • 144
  • 1
    `/me/friends` just return friends that have granted user_friends permission to the app. You will not get all friends – WizKid Apr 21 '15 at 16:18
  • 1
    possible duplicate of [Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app](http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-u) – WizKid Apr 21 '15 at 16:18

1 Answers1

0

As from Facebook api docs, this code would return all your friends who have logged in using Facebook in your android app. I also faced the same issue but after my friends installed my android app into their devices and logged in with Facebook in the app, this code returned list of all those friends with name and their Facebook ids.

Nitesh Tarani
  • 726
  • 6
  • 6