I'm making a request to Facebook api in android with SDK 3.0.1 and I'm running it with executeAndWait() but the request doesn't work (in debug it jumps directly to next row, not even a millisecond..) and the callback is not called. Can you help me with a fix?
I'm making a request to get the user's rsvp_status of a list of events collected in eventCollection.getAroundMeEventList()
. The request is correct (I tried it in open graph).
I never get inside the callback, so even if inside there an error I don't care about it, I want to know how to make this request work.
here's my code:
fql string request:
String rsvpRequest = "{";
for (EventData event : eventCollection.getAroundMeEventList()) {
rsvpRequest += "\""
+ event.event_ID
+ "\":"
+ "\"SELECT rsvp_status FROM event_member where eid = "
+ event.event_ID + " and uid = me()\",";
}
rsvpRequest += "}";
bundle = new Bundle();
bundle.putString("q", rsvpRequest);
facebook Request.Callback:
Callback callback = new Callback() {
@Override
public void onCompleted(Response response) {
try {
JSONObject jObject = response.getGraphObject()
.getInnerJSONObject();
JSONArray jArray = jObject.getJSONArray("data");
jArray = jArray.getJSONArray(0);
for (int i = 0; i < jArray.length(); i++) {
jObject = jArray.getJSONObject(i);
String ID = jObject.getString("name");
JSONArray jj = jsonObject
.getJSONArray("fql_result_set");
if (jj.length() == 0) {
eventCollection.getAroundMeEventByID(ID).status_attending = "Not Invited";
} else {
jObject = jj.getJSONObject(0);
eventCollection.getAroundMeEventByID(ID).status_attending = jObject
.getString("rsvp_status");
}
}
} catch (Exception e) {
}
}
};
facebook Request:
Request request = new Request(Session.getActiveSession(), "fql", bundle,
HttpMethod.GET, callback);
request.executeAndWait();