How to get user likes from Facebook with Android s

2019-04-03 00:09发布

问题:

I would get user likes from facebook using Android sdk 3.0 beta.

How do I do this?

回答1:

Provided that you have a valid session, this is the code to get the user likes

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