Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to integrate Facebook API in Android Application?

I am developing a mobile social TV application on Android.I want to integrate Facebook with my application so that I can:

  1. Share things on Facebook
  2. Send request to friends on Facebook to join the application
like image 560
Prasad Akmar Avatar asked Mar 29 '12 11:03

Prasad Akmar


People also ask

What is Facebook SDK Android?

The Facebook SDK for Android gives you access to the following features: Facebook Login — A secure and convenient way for people to log into your app or website by using their Facebook credentials. Sharing — Enable people to post to Facebook from your app. People can share, send a message, and share to stories.

How do I integrate social media on Android?

Downloading SDK and integrating it Once imported, right click on your facebook project and click on properties. Click on android, click on add button and select facebook sdk as the project. Click ok.

What is a FB 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. This course helps you understand the purpose of the Facebook SDK and App Events for Android and iOS.

How to integrate Facebook in Android app?

This example demonstrates about How to integrate facebook in Android App Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 – Please follow Q21 to integrate Facebook. Step 3 − Add the following code to res/layout/activity_main.xml.

How to add API to Facebook app?

API Integration Setup. 1 Step 1: Create a Developer App. Go to Facebook for developers and click My Apps > Create App. You can also use an existing app. 2 Step 2: Create a System User. 3 Step 3: Assign Assets. 4 Step 4: Generate a System User Access Token. 5 Step 5: Generate a Page Access Token. More items

How do I import Facebook SDK into an Android app?

Now you can import com.facebook.FacebookSdk into your app. Add your Facebook App ID and Client Token to your project's strings file and update your Android manifest: 1. Open your /app/res/values/strings.xml file.

How to add Facebook app ID and client token in Android?

Now you can import com.facebook.FacebookSdk into your app. Add your Facebook App ID and Client Token to your project's strings file and update your Android manifest: 1. Open your /app/res/values/strings.xml file. 2. Add a string element with the name attribute facebook_app_id and value as your Facebook App ID to the file. For example 3.


2 Answers

You may use this.

Facebook Android SDK

But carefull about handling activity result. If you test integration in simulator you haven't installed facebook app. and sdk will show you a dialog with webview. But on a real phone if facebook app. is installed, authorization will go via app.

like image 115
Apurv Gupta Avatar answered Oct 21 '22 13:10

Apurv Gupta


you need to install an extension, similar to the core Android SDK, but no, here is what you need to do:

1.) go to https://github.com/facebook/facebook-android-sdk

2.) download the facebook directory ONLY! The other directories are only examples.

3.) Put the files from the src (you can copy the drawables too, if you want to) in the package, you are currently working with

4.) You are good to go, you can use the facebook "SDK"

see also these examples https://github.com/facebook/facebook-android-sdk/tree/master/samples , it is working example provided by facebook

like image 42
Ronak Mehta Avatar answered Oct 21 '22 13:10

Ronak Mehta