如何从Facebook获取用户喜好与Android SDK 3.0(How to get user

2019-08-02 11:55发布

我使用的是Android SDK 3.0测试版从Facebook获取用户喜欢。

我该怎么做呢?

Answer 1:

只要你有一个有效的会话,这是代码来获取用户喜好

    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();


文章来源: How to get user likes from Facebook with Android sdk 3.0