Android Facebook SDK - Get user events

筅森魡賤 提交于 2019-12-31 02:14:27

问题


i've being able to login and get the user infos from the api with this code:

Facebook facebook = new Facebook("XX");
    AccessToken token = AccessToken.createFromExistingAccessToken("XX", new Date(facebook.getAccessExpires()), 
            new Date(facebook.getLastAccessUpdate()), 
            AccessTokenSource.FACEBOOK_APPLICATION_NATIVE, Arrays.asList(permissions));
    Session.openActiveSessionWithAccessToken(getActivity(), token, callback);

    session = Session.getActiveSession();

    Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

        @Override
        public void onCompleted(GraphUser user, Response response) {
            Object proper = user.getFirstName();
            System.out.println(proper);

        }
    });

I'm using this fixed tokens cause its always come from the same user as some sort of a host but i need to get the user events and havent seen any documentation that shows how to do it, does anyone have any idea of how to get the user events that he created?

thank you!


回答1:


I've managed to achieve what i want using a FQL Query with this code:

String fqlQuery = "SELECT eid, name, pic, creator, start_time FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid='XX' and rsvp_status='attending')";       
    Bundle params = new Bundle();
    params.putString("q", fqlQuery);
    Request request = new Request(session, "/fql", params, HttpMethod.GET, 
            new Request.Callback() {

                @Override
                public void onCompleted(Response response) {
                    System.out.println("Result: " + response.toString());                       
                }
            });
    Request.executeBatchAsync(request);


来源:https://stackoverflow.com/questions/15606514/android-facebook-sdk-get-user-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!