问题
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