android - RequestBatch.Callback onBatchCompleted() not called -
having trouble using facebook graph api library android when sending batch of requests.
not getting callback when running code:
requestbatch requestbatch = new requestbatch(requests); requestbatch.addcallback(new com.facebook.requestbatch.callback() { @override public void onbatchcompleted(requestbatch batch) { log.e(log_tag, "onbatchcompleted()"); } }); requestbatch.executeasync();
found answer.
you need set callback each individual request batch-related callback, because onbatchcompleted callback called after per-request callbacks called..
(string friend : friends) { mylog.d(log_tag, "adding request " + friend.getinterestfbid()); string graphpath = friend + "/feed"; request request = new request(session, graphpath, null, httpmethod.get); bundle params = new bundle(); params.putstring("fields", "id,"+ "name,"+ "username,"+ "feed,"); request.setparameters(params); // vital or batch callback never arrive request.setcallback(new com.facebook.request.callback() { @override public void oncompleted(response response) {} }); requests.add(request); }
Comments
Post a Comment