Thursday, November 17, 2016

facebook4j Events

import facebook4j.Event;
import facebook4j.Facebook;
import facebook4j.FacebookException;
import facebook4j.FacebookFactory;
import facebook4j.ResponseList;
import facebook4j.auth.AccessToken;

Facebook facebook = new FacebookFactory().getInstance();
facebook.setOAuthAppId(appId, appSecret);
facebook.setOAuthPermissions(commaSeparetedPermissions);
facebook.setOAuthAccessToken(new AccessToken(accessToken, null));

ResponseList<Event> events;
int count;
try {
events = facebook.getEvents();
count = events.size();
} catch (FacebookException e) {
e.printStackTrace();
}

No comments: