Get friend list facebook 3.0

前端 未结 7 899
感情败类
感情败类 2020-12-12 22:57

I\'m trying to obtain my friend list from facebook using new SDK(3.0). I\'m facing problems related to what kind of params I need to insert in a Bundle and how to use newMyF

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 23:10

    Using FQL Query

    String fqlQuery = "SELECT uid,name,pic_square FROM user WHERE uid IN " +
            "(SELECT uid2 FROM friend WHERE uid1 = me())";
    
    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

    Ref : Run FQL Queries

提交回复
热议问题