Skip to content Skip to sidebar Skip to footer

Check If Facebook Post Was Successful From Android Application

I'm using this code from the Facebook Android Sdk to post on wall. I would like to have some feedback to know if the post was successfull or not. How to check this ? Any method fro

Solution 1:

The onCompleted(Response response) method from the callback receives an instance of the Response class. You can use this object to check if the request has been processed successfully. A successfull HTTP request's response code should begin with 2xx (e.g. 200 OK, 201 CREATED etc).

response.getConnection().getResponseCode();

If it failed for some reason, you can retrieve a detailed error, like you already do in this line:

FacebookRequestError error = response.getError();

Post a Comment for "Check If Facebook Post Was Successful From Android Application"