0
votes

I use Facebook 4.7 SDK and Graph Ver.2.5 I do not get Detail of a users friends

GraphRequest request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
    @Override
    public void onCompleted(JSONObject jsonObject, GraphResponse graphResponse) {
        if (jsonObject != null) {

            try {
                JSONObject friends = jsonObject.getJSONObject("friends");
                JSONArray array = friends.getJSONArray("data");
                for (int i = 0; i < array.length(); i++) {
                    JSONObject object = array.getJSONObject(i);
                    Toast.makeText(getApplication(),"...Name:" + object.getString("name"),Toast.LENGTH_SHORT).show();
                    Log.d("MyApp", "...ID:" + object.getString("id"));
                    Log.d("MyApp", "...Name:" + object.getString("name"));
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }
}); 

can someone give a full example of the facebook graph API friend list?

1
Hi Prashant, asking tutorial/example is offtopic here. Instead please describe your specific problem.Emil
You are aware that your app can only get friends that are users of the same app as well, and have granted user_friends permission too – right?CBroe

1 Answers

0
votes

You can't Get user's Friends unless they given permission(user_friends) to your app. You can get only count of user's friend.