0

를 사용하여 로그에, 이런 식으로 뭔가를 사용자 그룹가져 오기 사용자 그룹 I은 사용자 그룹을 가져 그들을 나열 할 싶지만, 페이스 북에서 그룹을 가져올 수 없습니까 하지만 내가 여기에 I를</p> <pre><code>*Successful Login *fetch friend list *i have also allowed the permission user_groups for fetching user groups </code></pre> <p>을 할 수 있어요 페이스 북의 API를

AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); 
mAsyncRunner.request("me/groups", params, 
        new GroupsRequestListener()); 

public class GroupsRequestListener extends BaseRequestListener { 

    @Override 
    public void onComplete(final String response, final Object state) { 
     dialog.cancel(); 
     Log.v("response", response); 
     Intent myIntent = new Intent(getApplicationContext(), 
       GroupsList.class); 
     myIntent.putExtra("API_RESPONSE", response); 
     startActivity(myIntent); 
    } 

    public void onFacebookError(FacebookError error) { 
     dialog.cancel(); 

     Toast.makeText(getApplicationContext(), 
       "Facebook Error: " + error.getMessage(), Toast.LENGTH_SHORT) 
       .show(); 
    } 

} 

를 가져 오는이 같은 일을하지만 응답을 가지고 있어요

06-15 07:43:19.563: V/response(645): {"error":{"message":"(#100) Unknown fields: location,birthday","type":"OAuthException","code":100}} 

"me/friends"매개 변수는 친구 목록을 가져 오는 데 적합합니다. 사용자 그룹을 가져 오는 데 "me/groups"매개 변수가 맞습니까?

답변

3

감사합니다. @Christoph Eberhardt. 당신의 도움으로 해결책을 얻었습니다. 내가 실수 한 것은 worng 요청입니다. parameters. 매개 변수는 위의 코드가 완벽하게 작동하는 경우 요청 매개 변수를 설정 한 후

Bundle params = new Bundle(); 
params.putString("fields", "name"); 

이어야합니다. 사용자 그룹을 가져 오는 완벽한 솔루션은

//onCreate 
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); 
Bundle params = new Bundle(); 
params.putString("fields", "name"); 

mAsyncRunner.request("me/groups", params, 
       new GroupsRequestListener()); 

//then 

public class GroupsRequestListener extends BaseRequestListener { 

@Override 
public void onComplete(final String response, final Object state) { 
    dialog.cancel(); 
    Log.v("response", response); 
    Intent myIntent = new Intent(getApplicationContext(), 
      GroupsList.class); 
    myIntent.putExtra("API_RESPONSE", response); 
    startActivity(myIntent); 
    } 

public void onFacebookError(FacebookError error) { 
    dialog.cancel(); 

    Toast.makeText(getApplicationContext(), 
      "Facebook Error: " + error.getMessage(), Toast.LENGTH_SHORT) 
      .show(); 
    } 

} 
2

요청 매개 변수 오류로 인해 사용자 쪽이 잘못되었습니다. 친구를 요청할 때 친구의 생일과 위치를 명시 적으로 요청할 수 있습니다. 아마 그룹에는 그 속성이 없을 것입니다.

요청 매개 변수를 확인하면 정상이어야합니다.

+0

감사합니다. Christoph Eberhardt 저도 알았습니다. –