So I\'m currently trying to retrieve event images from a FB page I created for an organization I\'m a part of. When make a call to graph.facebook.com/{event-id}/picture I get a
It turns out there's an API for the cover image. You would think the Event Picture docs would at least mention it .. but it's not the case.
Cover Photo API: https://developers.facebook.com/docs/graph-api/reference/cover-photo/
This worked for me:
String eventCoverImage = "/v2.8/" + eventId;
Bundle params = new Bundle();
params.putBoolean("redirect", false);
params.putString("fields", "cover");
new GraphRequest(
AccessToken.getCurrentAccessToken(),
eventCoverImage,
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(final GraphResponse response) {
// thread is necessary for network call
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String picUrlString = (String) response.getJSONObject().getJSONObject("cover").get("source");
URL imgValue = new URL(picUrlString);
Bitmap eventBitmap = BitmapFactory.decodeStream(imgValue.openConnection().getInputStream());
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
thread.start();
}
}
).executeAsync();
Additionally, this can be of help to try/figure things out with the api https://developers.facebook.com/tools/explorer