0

https://developers.facebook.com/docs/opengraph/guides/og.likes/

I need to implement like feature in my android app. I read that facebook feeds cannot be liked through facebook android sdk. So my plan was to do inapp liking.

Any tutorials available? Could anyone help me.

nullUser
  • 1,159
  • 2
  • 15
  • 26
  • check this post, there is well-formed library to solve this issue: http://stackoverflow.com/a/23853937/1891118 – Oleksii K. May 25 '14 at 09:40

2 Answers2

0

This is some code for review

wb = (com.fb.facebook.Like) findViewById(R.id.webview);
    wb.setInitialScale(1000);
    ((com.fb.facebook.Like) findViewById(R.id.webview))
            .setApplicationKey("XXXXXXXXXXXXXXX").setUriToLike(
                    "https://www.facebook.com/pages/XXXXXXXXXXXXXXXXXXXX/123234231234124?fref=ts")
            .load();

And Go through this also

/**
 * Loads like button from facebook
 */
private void loadForLikeUrl() {
    loadUrl("http://www.facebook.com/plugins/like.php?api_key="
            + facebook.getAppId()
            + "&extended_social_context=false&font=arial&layout=button_count&locale=en_US"
            + "&node_type=link&sdk=joey&send=false&show_faces=false&width=450&href="
            + URLEncoder.encode(uri));
}


/**
 * You must set like uri and application key for this method to work
 */
public void load() {
    if (facebook != null && uri.length() > 0) {
        SharedPreferences preferences = PreferenceManager
                .getDefaultSharedPreferences(activity);
        String access_token = preferences.getString("access_token", null);
        long expires = preferences.getLong("access_expires", 0);
        if (access_token != null) {
            facebook.setAccessToken(access_token);
        }
        if (expires != 0) {
            facebook.setAccessExpires(expires);
        }
        loadForLikeUrl();
    }
}

This can be helpful to you. Have a nice day... :)

This is Full Like page code for fbLike Like.java

AndyBoy
  • 564
  • 6
  • 29
  • I am confuse ... Please help me how to use above code.. I want to like my facebook page form my android app.. Thanks.. – ADT Jun 24 '14 at 06:29
  • I am new to facebook developer.. can you please guide me.. How to do that.. if you know then , Please Help me – ADT Jun 25 '14 at 09:24
0

I found the solution here:

https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes

Required Permission: publish_actions

Bundle params = new Bundle();
params.putString("object", "http://samples.ogp.me/226075010839791");

Request request = new Request(
    Session.getActiveSession(),
    "me/og.likes",
    params,
    HttpMethod.POST
);
Response response = request.executeAndWait();
// handle the response
nullUser
  • 1,159
  • 2
  • 15
  • 26