0

I retrieved all the posts from my Facebook wall but now I want to like the post using the post_id. I am using following code but getting below mentioned exception

{Response:  responseCode: 200, graphObject: null, error: {HttpStatus: -1, errorCode: -1, errorType: null, errorMessage: null}, isFromCache:false}

My code:

Request likeRequest = new Request(Session.getActiveSession(), fBPostId + "/likes", null, HttpMethod.POST, new Request.Callback() 
{
@Override
public void onCompleted(Response response) 
{
   Log.d("Like clicked",response.toString());

}
});
Request.executeBatchAndWait(likeRequest);
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user2064024
  • 531
  • 2
  • 7
  • 20
  • Can you do a `Log` on `fBPostId` and check that it has a value in it? – Siddharth Lele Jul 16 '13 at 08:17
  • Your code is seems ok. you can check session state is it opened? or check fbPostId is it right? – Muhammad Aamir Ali Jul 16 '13 at 08:19
  • yes i m getting correct value in it – user2064024 Jul 16 '13 at 08:20
  • session state is open and post id is also correct – user2064024 Jul 16 '13 at 08:24
  • i m getting folowing in Session.getactivesession {Session state:OPENED,token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[friends_actions.news, read_stream, status_update, photo_upload, video_upload, email, create_note, share_item, publish_stream, read_insights, publish_actions, user_birthday, user_relationships, user_relationship_details, user_likes, user_groups, user_photos, user_status, user_subscriptions, friends_birthday, friends_relationships, friends_relationship_details, friends_location, friends_likes, friends_activities, friends_interests, friends_status, basic_info]}, } – user2064024 Jul 16 '13 at 08:25

1 Answers1

0

You should grant "publish_actions" permission to do that.

If you are using LoginButton :

loginButton.setPublishPermissions(Arrays.asList("publish_actions"));