Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

I have a valid facebook Session opened and the ID post I want to like.

How can I implement this function?

Thanks

like image 826
Giulio Bider Avatar asked Jan 03 '13 21:01

Giulio Bider


People also ask

What is Facebook SDK version?

This documentation describes how to integrate your Android app with Facebook to build engaging social apps by using the Facebook SDK for Android. To learn more about using Facebook development tools, see App Development. The current version of the Facebook SDK for Android is version 15.0.

What is the purpose of Facebook SDK?

The Facebook SDK is a set of software components that developers can include in their mobile app to understand how people use the app, run optimized marketing campaigns and enable Facebook login and social sharing.

How do I update Facebook SDK?

Select the App you want to upgrade (you might have access to multiple apps) Click Settings > Advanced. Select the latest version under the Upgrade API Version section for both “Upgrade All Calls” and “Upgrade Calls for App Roles” Save.


1 Answers

I found a solution.

To like post I've implemented a simple POST request using likes connection of facebook post id.

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);
like image 59
Giulio Bider Avatar answered Sep 18 '22 23:09

Giulio Bider