How to 'likes' a post on Facebook wall

I have an android application integrating Facebook for post on Facebook wall.Now i want to like my post programatically.My searching results shows that OBJECT ID or COMMENT ID is needed for this purpose.How to obtain this?I am using Facebook Graph Api.I know that it is not possible to 'like' pages via the Graph API. My code for post to wall is

    facebook.dialog(activity, "feed", bundle, new DialogListener() {
            public void onComplete(Bundle values) {


            public void onFacebookError(FacebookError error) {


            public void onError(DialogError e) {

            public void onCancel() {

I there any way to like a post?

Thanks in Advance


Assuming you have the publish_stream permission and you have the POST_ID that you want to create the like for, then its simply doing the following:

mAsyncRunner.request("/POST_ID/likes", null, "POST", new likeListener(), null);

The likeListener can then determine whether it succeeded or not. Facebook returns in the response true if successful, false if not. Source

If you don't have the POST_ID then you have to get it somehow. You should be more specific as to what type of post you want to like. For example, if you just created a post on someone's wall using our SDK, we return the post ID in your onComplete method in your code above in the bundle values if it succeeds. Save that post id and use it as the POST_ID in the example I gave you earlier.

You cannot force users to like your application(due to spamming reasons). The only way you can get them to like your page/app is embedding the like fbml code or iframe in a web view. That documentation is in place to like a friends wall post or comment or photo, as those are the types of items you can like for a user, in case for example you were writing a Facebook client. If that is what you are trying to do, don't send the app_id as you are doing, but send the post id of the users post.

Need Your Help

Calling session bean from servlet vs jsp->servlet grants different result

java jsp servlets ejb session-bean

I'm having a problem trying to call a method of session bean, when calling firstly the servlet from a JSP, then the servlet calling the method of session bean to obtain some data it seems to get a