如何通过Android sdk 3.0获得Facebook用户的喜欢

时间:2012-11-08 16:26:41

标签: android facebook facebook-android-sdk

我会使用Android sdk 3.0 beta从Facebook获得用户喜欢。

我该怎么做?

1 个答案:

答案 0 :(得分:10)

如果您有一个有效的会话,这是让用户喜欢的代码

    Session session = Session.getActiveSession();
    Request.Callback callback = new Request.Callback() {

        @Override
        public void onCompleted(Response response) {
            // response should have the likes
            Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_LONG).show();
        }
    };
    Request request = new Request(session, "me/likes", null, HttpMethod.GET, callback);
    RequestAsyncTask task = new RequestAsyncTask(request);
    task.execute();