Henri L.
Henri L.

Reputation: 160

Android - Mobile Like Button

5 days ago, on 10/02/2014, Facebook published on their developer blog a new post: "Mobile Like Button now Available to Everyone": https://developers.facebook.com/blog/post/2014/10/02/mobilelike/ and has provided documentation: https://developers.facebook.com/docs/android/like-button

I have tried to follow the documentation to have users like my App but have had no success:

Here is what I did following the Facebook documentation:

Then, in the main Activity of my app:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    uiHelper = new UiLifecycleHelper(this, callback);
    LikeView likeView = (LikeView) findViewById(R.id.like_view);
    likeView.setObjectId("[myPageId]");
...

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    uiHelper.onActivityResult(requestCode, resultCode, data, null);
...

In res/values/strings.xml, I added:

<string name="facebook_app_id">[MyAppId]</string>

in the AndroidManifest.xml file, I added in the Application tab:

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

Upvotes: 3

Views: 1650

Answers (2)

liltof
liltof

Reputation: 2192

It seems that you MUST NOT set a numeric height to the faceboo LikeView, it has to be wrap content.

Upvotes: 1

Kyeson
Kyeson

Reputation: 960

When everything confirmed to be correct.Then don't forget to add your facebook account as a tester of your app, so that you can test the whole function.Also, if you want to use "like button" with anyone else, you should submit your app to Facebook and ask for "like button" this ability at Here

Upvotes: 0

Related Questions