简体   繁体   中英

Why do I get an empty list of friends? Facebook SDK Android

My Android Code:

loginButton.setReadPermissions("user_friends");
    loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            profile = Profile.getCurrentProfile();
            Log.e("AAAAA=onSuccess", profile.getId());
            GraphRequestAsyncTask graphRequestAsyncTask = new GraphRequest(
                    AccessToken.getCurrentAccessToken(),
                    "/me/friends",
                    null,
                    HttpMethod.GET,
                    new GraphRequest.Callback() {
                        public void onCompleted(GraphResponse response) {
                            try {
                                JSONArray rawName = response.getJSONObject().getJSONArray("data");
                                Log.e("AAAAA=onCompleted", rawName.toString());
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }
                    }).executeAsync();

Why do I get an empty list of friends?

{
  "data": [
  ]
}

I only have 1 each . But I get an empty list . Why is this happening? Tell me what should I do ?

Applications created after April 30th 2014 uses version 2.0+ of the Graph API, which will only return your user's friends that have you app installed. There is no way to retrieve all the friends of you user. It is against Facebook's privacy policy. More Info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM