2

シングルサインオンにfacebook-android-sdkを使用していますが、ユーザーのfacebookプロファイルデータを取得できません。これは私のコードです:

try {
            JSONObject me = new JSONObject(facebook.request("me"));
            String id = me.getString("id");
            String name = me.getString("name");
            System.out.println("Id: " + id + "  ---- " + name);
        }catch(Exception ex) {
            System.out.println(ex);
        }

ユーザーデータプロファイルを取得するにはどうすればよいですか?ありがとうございます!

4

1 に答える 1

3

ログインしている場合。

AsyncFacebookRunner myAsyncRunner = new AsyncFacebookRunner(facebook);
myAsyncRunner.request("me", new meRequestListener());

リクエストリスナー:

public class meRequestListener implements RequestListener() {

    @Override
    public void onComplete(String response, Object state) {
        //response is your JSON response
    }

    //You also have to override all the other methods
}
于 2012-05-28T21:49:01.507 に答える