Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

android - Is it possible to "Like" a "fan page" using the Facebook SDK?

I am trying to let users "like" a Facebook fan page from within an Android app. I am able to successfully "like" objects such as wall comments using code like this,

mFacebook = new Facebook(APP_ID);   
SessionStore.restore(mFacebook, this);        

mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle parameters = new Bundle();
mAsyncRunner.request(COMMENT_ID + "/likes", parameters, "POST", new MyRequestListener(), "");

However, if I put in a page id rather than a comment id, I get this error message in the Facebook response,

Response: {"error":{"type":"OAuthException","message":"(#200) App does not have permission to make this call"}}

I am obtaining both the "publish_stream" and "offline_access" publishing permissions at login, and they are given to the Facebook object with SessionStore.restore().

1) Does Facebook let apps "like" fan pages?

2) If so, any ideas on what I am doing wrong?

Thanks, Matt

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Facebook documentation for Pages has been updated and is current (see https://developers.facebook.com/docs/reference/api/page/). You cannot like a Page via the Graph API, even though you can read the like count information.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...