简体   繁体   中英

Android Facebook SDK - Get user events

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM