Search code examples
androidfacebookfacebook-graph-apifacebook-likefacebook-android-sdk

Easy Facebook Android SDK : How to like a Page


I am using Easy Facebook android SDk v2.3. I could successfully access a page and get details of page including number of likes.

I am trying to implement like button in the app using setLikes(String likes); method of Page class but getting confused with what is to be passed as the parameter.

Sample Code :

  p = Global.graphApi.getPage("Page ID");
  p.setLikes(String likes);  //what should likes be replaced with, replacing it with user id didn't work

Any help on this is appreciated.


Solution

  • According to the facebook documentation, (Page), you cannot like a Page via Graph API, even though you can read the like count information.

    User, have to press the like button himself to like the page.

    The accepted answer here may help you: like android application page in facebook from application itself