GithubHelp home page GithubHelp logo

prashant31191 / fblikeandroid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuuneoi/fblikeandroid

0.0 1.0 0.0 140 KB

A wrapper for Facebook Native Like Button (LikeView) on Android

Java 100.00%

fblikeandroid's Introduction

FBLikeAndroid

A wrapper for Facebook Native Like Button (LikeView) on Android

Version

1.0.1

Installation

To use this library in your android project, just simply add the following dependency into your build.gradle

dependencies {
    compile 'com.inthecheesefactory.thecheeselibrary:fb-like:1.0.1'
}

Usage

Full document is available at http://inthecheesefactory.com/blog/how-to-add-facebook-like-button-in-android-app/en

First of all, you have to setup the create a Facebook App and setup Facebook SDK for Android in your Android App. Please check this link.

After that, place com.inthecheesefactory.lib.fblike.widget.FBLikeView wherever you want to place a Facebook Like Button, for example:

<TextView
    android:id="@+id/tvUrl"
    android:text="@string/hello_world" android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<com.inthecheesefactory.lib.fblike.widget.FBLikeView
    android:id="@+id/fbLikeView"
    androi:text="Login to Like"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

You could get a LikeView instance through getLikeView method.

FBLikeView fbLikeView = (FBLikeView) rootView.findViewById(R.id.fbLikeView);
LikeView likeView = fbLikeView.getLikeView();

To set a url and its type, you could do via LikeView's setObjectIdAndType method.

fbLikeView.getLikeView().setObjectIdAndType("YOUR_URL_HERE", LikeView.ObjectType.OPEN_GRAPH);

And to connect every single FBLikeView to Facebook Login process, you have to add this line to every single Activity's onActivityResult in your app.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    FBLikeView.onActivityResult(requestCode, resultCode, data);
}

That's all. LikeView will now work perfectly in your app !

To disconnect your app from Facebook, just simply use this command:

FBLikeView.logout();

Change Logs

v1.0.1

Fix minor bug

v1.0.0

Update Facebook SDK version to v4.4.0

v0.9.3

Initial version

License

Apache 2.0

fblikeandroid's People

Contributors

nuuneoi avatar

Watchers

Prashant Patel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.