0

ユーザー グループを取得して一覧表示したいのですが、Facebook からグループを取得することはできますが、取得できません。

*Successful Login
*fetch friend list 
*i have also allowed the permission user_groups for fetching user groups

ここで、ユーザーグループを取得するためにこのようにしています

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」はユーザーグループを取得するのに適していますか?

4

2 に答える 2

3

@Christoph Eberhardt に感謝します。私はあなたの助けを借りて解決策を得ました。私が間違っていたのは、woregg のリクエスト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();
    }

}
于 2012-06-15T08:44:37.123 に答える
2

このエラーは、リクエスト パラメータの間違いを示しています。友達をリクエストするときは、友達の誕生日と場所を明示的にリクエストできます。おそらく、グループにはこれらの属性がありません。

リクエストパラメータを確認してください。問題はありません。

于 2012-06-15T08:29:00.080 に答える