Android: get facebook friends list

前端 未结 8 1188
青春惊慌失措
青春惊慌失措 2020-11-29 06:53

I am using the Facebook SDK to post messages on walls.

Now I need to fetch the Facebook friends list. Can anybody help me with this?

-- Edit --



        
8条回答
  •  一生所求
    2020-11-29 07:44

    Using FQL Query

    String fqlQuery = "SELECT uid, name, pic_square FROM user WHERE uid IN " +
            "(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";
    
    Bundle params = new Bundle();
    params.putString("q", fqlQuery);
    Session session = Session.getActiveSession();
    
    Request request = new Request(session,"/fql", params,HttpMethod.GET, new Request.Callback(){         
        public void onCompleted(Response response) {
            Log.i(TAG, "Result: " + response.toString());
    
            try{
    
                GraphObject graphObject = response.getGraphObject();
    
                JSONObject jsonObject = graphObject.getInnerJSONObject();
                Log.d("data", jsonObject.toString(0));
    
                JSONArray array = jsonObject.getJSONArray("data");
    
                for(int i=0;i

提交回复
热议问题