简体   繁体   English

Android如何喜欢facebook 3.0 sdk的帖子

[英]Android How to like a post with facebook 3.0 sdk

I want to implement "Like" option in my Android app, but I don't know which Request to use. 我想在我的Android应用中实现“赞”选项,但我不知道要使用哪个请求。

I have a valid facebook Session opened and the ID post I want to like. 我打开了有效的Facebook会话和我想要的ID帖子。

How can I implement this function? 我该如何实现这个功能?

Thanks 谢谢

I found a solution. 我找到了解决方案。

To like post I've implemented a simple POST request using likes connection of facebook post id. 喜欢帖子我已经使用facebook post id的喜欢连接实现了一个简单的POST请求。

This is the code: 这是代码:

Request likeRequest = new Request(Session.getActiveSession(), fBPostId + "/likes", null, HttpMethod.POST, new Request.Callback() {

         @Override
         public void onCompleted(Response response) {
                Log.i(TAG, response.toString());
         }
});
Request.executeBatchAndWait(likeRequest);

A cursory search ( 1 , 2 , 3 ) seems to indicate that it's not possible to directly "Like" things as a user via the Graph API, for security/spam reasons. 粗略搜索( 123 )似乎表明,它不可能直接“像”的东西经由图形API用户,对于安全/垃圾邮件的原因。 One commonly-suggested alternative has traditionally been to show a Facebook-controlled "Like" button in a WebView and include that in your application instead. 传统上,一种常用的替代方法是在WebView中显示Facebook控制的“Like”按钮,并将其包含在您的应用程序中。

However, more recently, the Facebook developer guide has provided one possible solution for how you can implement "like"-style functionality in your app when it comes to publishing stories on the user's behalf, though it's not precisely the same thing as what you seem to be asking for. 然而,最近,Facebook开发人员指南提供了一种可能的解决方案,用于在代表用户发布故事时如何在应用中实现“喜欢”式功能,尽管它与您看起来的不完全相同要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM