2012-06-25 5 views
0

가능한 중복 얻을 : 나는 안드로이드에 내 친구가 페이스 북의 모든 ID를 얻으려고
Getting all Facebook friends using Graph API페이스 북 친구 아이디를

합니다. 이것은 내가 사용하는 코드입니다 :

public static List<String> getFaceBookFriendsIDs() { 

     List<String> friendsList = null; 
     try { 
      JSONObject result = new JSONObject(ParseFacebookUtils.getFacebook().request("me/friends")); 
      JSONArray friendsArray = result.getJSONArray("data"); 

      friendsList = new ArrayList<String>(); 
      for (int i = 0; i < friendsArray.length(); i++) { 
       friendsList.add(friendsArray.getJSONObject(i).getString("id")); 
      } 
     } 
     catch (MalformedURLException e) { 
      e.printStackTrace(); 

     } 
     catch (JSONException e) { 
      e.printStackTrace(); 

     } 
     catch (IOException e) { 
      e.printStackTrace(); 

     } 

     return friendsList; 

    } 

그러나 내가 가지고있는 친구들의 수와 같은 가치는 아닙니다. 그게 정상인가, 아니면 내가 뭔가 잘못하고있는 것인가?

답변

-1

RestFB API를 사용하십시오! see here 모든 것이 더 쉽고 (아마도) 약간의 오버 헤드가 발생하지만, 여전히 쉽습니다.