Facebook is one of the largest and hottest social Media Platform connecting people at vast range . In today's date these social media gigs like Facebook , twitter , whatsapp , Insta has become a part of your day to day routine which not only keeps you connected with the world but also updates you with the surroundings news.
Today there are no of mobile apps asking to login with your Facebook credentials and to make it possible we need to integrate it with our android project. Amalgamating Facebook is quite an easy stuff when you need to workout with eclipse but when it comes to android studio it's not that easy bread to be swollen up.
I am pretty sure that you'll get thousands of columns and technological blogs making you understand integration of FB with eclipse but very are the fewer blogs that not only guides you about android studio but also in depths you by the steps that makes it easy for developers as well as project trainees to integrate a huge social media platform popularly knows as “FB” and make their app worth using.
And the output you will receive is below Snapshot :
Step 1: Download Facebook SDK
First you need to download Facebook SDK and then import it into android studio.
Step 2: Creating Project
Now once you download Facebook SDK then you need to create a new fresh project in android Studio.
Step 3: Linking SDK
Now you Link up the FB SDK as abc project with your Demo app where you need to add module dependency for Facebook.
Step 4: Get Key and Value pair
Once you link up your FB SDK then you are liable to get Key Hash Value for your computer.
Key Hash Value : It is used as a security check for Facebook during login process.
To get Key Hash Value for your machine/computer just write the below code in onCreate() method of main Class:
Step 5: Create FB App
In order to get Facebook App ID we need to create an app on FB developer site .
For that redirect to developers site then, after login add new app and Give your application name.
Then choose your category and later on click to Confirm.
By this our app is created so now you can navigate to dashboard and the note your App Id.
for registration of Package & activity then go to Settings -> Click on Add Platform & select android
Now you Register your app package name & activity that utilizes FB sharing and add key hash values as explained in the above followed steps.
Step 6: Adding App Id
Now, just add up your App ID in file String. Xml of your Demo Project and then replace your app id in place of "your app_id".
Step 7: Make changes in Manifest File
Open up your Manifest files and add following credentials:
Adding of meta data in tag:
Adding New Activity:
Step 8: Facebook Login
Session.openActiveSession() method of session class in MainActivity.java is called to integrate facebook with your android app.
Step 9: Login Successful
since we are done with Facebook login in Android we need to handle onActivityResult() in Mainactivity.java
How to Fetch User Data From Facebook ?
Once login to facebook is done, Call () method of StatusCallback() is called where newMeRequest() method inside Call() would be executed .
After request executes , Callback is called that returns object of Graph User which returns friends from friend list that uses FB login for making request.
To get friends list details user_friends permission is required.
About Hyperlink Infosystem
It is one of the best app development India company that gives best ever solutions to many top app development companies for various platforms irrespective of the technology . Whatever the case may be Hyperlink always proves to cart best ever solutions satisfying its clients in all the manners. Contact us for better Solutions ..!
(Your email address will not be published. Required fields are marked *)