{"id":84487,"date":"2021-09-10T09:00:48","date_gmt":"2021-09-10T03:30:48","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=84487"},"modified":"2024-08-05T22:02:26","modified_gmt":"2024-08-05T16:32:26","slug":"android-facebook-integration","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/","title":{"rendered":"Android Facebook Integration"},"content":{"rendered":"<p>In this article, we will show you how you can allow Facebook integration in your apps. Imagine allowing users to access your application effortlessly by logging in through their Facebook account. With the widespread adoption of Facebook, Google, and Phone sign-ins, these features have become a staple for modern apps, offering simplicity and enhanced security.<\/p>\n<p>Integrating Facebook not only streamlines the login process but also enhances user engagement by leveraging familiar and trusted platforms. So, get ready to elevate your app&#8217;s user experience as we dive into the essential steps for integrating Facebook into your application. Let&#8217;s get started!<\/p>\n<h3>Implementation of Facebook Integration in your app<\/h3>\n<p><strong>Step 1:<\/strong> First of all, use the link to access the <a href=\"https:\/\/developers.facebook.com\/\">Facebook developer\u2019s site<\/a>.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84704\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_1.png\" alt=\"Facebook developer\u2019s site\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p>You can see a screen like above, and you just need to click on Login.<\/p>\n<p><strong>Step 2:<\/strong> After clicking the login button, you need to log in with your Facebook account. Now, you will be redirected to a page to create your developer account. Fill in all the asked details asked and then click on create.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84705\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_2.png\" alt=\"Facebook Android Integration\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 3:<\/strong> After you have created your developer account, you will be redirected to the all apps console as shown below.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84706\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_3.png\" alt=\"Facebook for developers\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 4:<\/strong> Now click on the create app option and select the Consumer option.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84707\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_4.png\" alt=\"Facebook Consumer Option\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p>Now, provide a name to your application and your contact email, and then click on \u201cCreate App.\u201d Remember, you can\u2019t provide an application name associated with Facebook. In other words, you can\u2019t use the words like Facebook, FB, Book, Insta, Gram, Rift, etc., while providing an application name.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84708\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_5.png\" alt=\"Facebook Consumer Option\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 5:<\/strong> After creating your app, you will get the console as follows having the app ID and the functionalities provided by Facebook.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84709\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_6.png\" alt=\"Facebook App\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 6:<\/strong> Now, in our case, we will try to show you how you can add the Facebook Login feature to your app. So, for that, just click on the Set Up button of the Facebook Login section in the app console.<\/p>\n<p><strong>Step 7:<\/strong>Now, it will show you a screen to select the type of app you wish to add this feature. Here select Android and proceed.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84710\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_7.png\" alt=\"Facebook Android App\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 8:<\/strong> Now it will prompt you to download the Facebook SDK for Android. Simply download the Facebook SDK and click on next.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84711\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_8.png\" alt=\"Facebook SDK\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 9:<\/strong> Now, to add the Facebook SDK to your android app, you need to follow the below steps:<\/p>\n<p>A. Start your Android Studio and click on Create a New Project.<\/p>\n<p>B. Select Empty Activity, provide an application name and select the API level as 22.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84712\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_9.png\" alt=\"Android facebook SDK\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p>C. Now, go to Gradle Scripts and select build.gradle(project) and add the following repository in your buildscript { repositories { } }.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">mavenCentral() \r\n<\/pre>\n<p>D. Go to your build.gradle(app) file and paste the below dependency there.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">implementation 'com.facebook.android:facebook-android-sdk:[5,6)'\r\n<\/pre>\n<p>E. Now, rebuild your project and then open your MainActivity.kt file.<\/p>\n<p>F. In your MainActivity,macOS adds the below import statements.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import com.facebook.FacebookSdk;\r\nimport com.facebook.appevents.AppEventsLogger;\r\n<\/pre>\n<p><strong>Step 10:<\/strong> Now, it asks you to fill in the package name and the default activity class name.<\/p>\n<p><strong>Package Name:<\/strong> com.example.techvidvanintegrate<br \/>\n<strong>Default Class Name:<\/strong> com.example.techvidvanintegrate.MainActivity<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84713\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_10.png\" alt=\"Facebook SDK\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 11:<\/strong> After entering your package name and default class name, a popup will appear, warning you that your app couldn\u2019t be found on Google play, but you can avoid this warning and click on Use this as the package name.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84714\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_11.png\" alt=\"Facebook Google Play Package\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 12:<\/strong> To ensure proper and authentic interaction between your application and Facebook, you should create development keys for your applications. To do so,macOS, you can follow the below steps:<\/p>\n<h4>Windows<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">keytool -exportcert -alias androiddebugkey -keystore \"C:\\Users\\USERNAME\\.android\\debug.keystore\" | \"PATH_TO_OPENSSL_LIBRARY\\bin\\openssl\" sha1 -binary | \"PATH_TO_OPENSSL_LIBRARY\\bin\\openssl\" base64\r\n<\/pre>\n<h4>macOS<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">keytool -exportcert -alias androiddebugkey -keystore ~\/.android\/debug.keystore | openssl sha1 -binary | openssl base64\r\n<\/pre>\n<h4>Linux\/Ubuntu<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">keytool -exportcert -alias androiddebugkey -keystore ~\/.android\/debug.keystore | openssl sha1 -binary | openssl base64\r\n<\/pre>\n<p>Now, you will get a 28-digit key which you can enter, as shown below.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84715\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_12.png\" alt=\"Facebook key\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 13:<\/strong> Now, you would see an option to enable sign-on on your device. Just allow that option and proceed.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84716\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_13.png\" alt=\"Android Facebook Integration\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p><strong>Step 14:<\/strong> Now, you need to edit your resource and manifest file in your android application. The codes to be added will be available at your Facebook for developer console, and you just need to add them at their specific places.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84717\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/Guide_for_Facebook_14.png\" alt=\"Android Facebook Integration\" width=\"1848\" height=\"963\" \/><\/a><\/p>\n<p>In the above image, you can see the code which you need to add to your project. To make your work easier, I have kept the same below in a more straightforward manner:<\/p>\n<p>A. First, go to <strong>app &#8212;&gt; res &#8212;-&gt; values &#8212;&#8211;&gt; strings.xml<\/strong> and add the below code there.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;string name=\"facebook_app_id\"&gt;506549317105816&lt;\/string&gt;\r\n&lt;string name=\"fb_login_protocol_scheme\"&gt;fb506549317105816&lt;\/string&gt;\r\n<\/pre>\n<p>B. Now, you need to open your <strong>AndroidManifest.xml<\/strong> file and add the below internet permission there.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;uses-permission android:name=\"android.permission.INTERNET\"\/&gt;\r\n<\/pre>\n<p>Now add the below code, which consists of the meta-data, activity, and intent filter for Facebook login in your application.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;meta-data android:name=\"com.facebook.sdk.ApplicationId\" \r\n        android:value=\"@string\/facebook_app_id\"\/&gt;\r\n    \r\n    &lt;activity android:name=\"com.facebook.FacebookActivity\"\r\n        android:configChanges=\r\n                \"keyboard|keyboardHidden|screenLayout|screenSize|orientation\"\r\n        android:label=\"@string\/app_name\" \/&gt;\r\n    &lt;activity\r\n        android:name=\"com.facebook.CustomTabActivity\"\r\n        android:exported=\"true\"&gt;\r\n        &lt;intent-filter&gt;\r\n            &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;\r\n            &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\r\n            &lt;category android:name=\"android.intent.category.BROWSABLE\" \/&gt;\r\n            &lt;data android:scheme=\"@string\/fb_login_protocol_scheme\" \/&gt;\r\n        &lt;\/intent-filter&gt;\r\n    &lt;\/activity&gt;\r\n<\/pre>\n<p>Finally, your AndroidManifest.xml file will appear as follows:<\/p>\n<p><strong>Code: AndroidManifest.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    package=\"com.example.techvidvanintegrate\"&gt;\r\n\r\n    &lt;uses-permission android:name=\"android.permission.INTERNET\"\/&gt;\r\n\r\n    &lt;application\r\n        android:allowBackup=\"true\"\r\n        android:icon=\"@mipmap\/ic_launcher\"\r\n        android:label=\"@string\/app_name\"\r\n        android:roundIcon=\"@mipmap\/ic_launcher_round\"\r\n        android:supportsRtl=\"true\"\r\n        android:theme=\"@style\/Theme.TechVidvanIntegrate\"&gt;\r\n\r\n        &lt;meta-data android:name=\"com.facebook.sdk.ApplicationId\"\r\n            android:value=\"@string\/facebook_app_id\"\/&gt;\r\n\r\n        &lt;activity\r\n            android:name=\".MainActivity\"\r\n            android:exported=\"true\"&gt;\r\n            &lt;intent-filter&gt;\r\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\r\n\r\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\r\n            &lt;\/intent-filter&gt;\r\n        &lt;\/activity&gt;\r\n\r\n        &lt;activity android:name=\"com.facebook.FacebookActivity\"\r\n            android:configChanges=\r\n                \"keyboard|keyboardHidden|screenLayout|screenSize|orientation\"\r\n            android:label=\"@string\/app_name\" \/&gt;\r\n        &lt;activity\r\n            android:name=\"com.facebook.CustomTabActivity\"\r\n            android:exported=\"true\"&gt;\r\n            &lt;intent-filter&gt;\r\n                &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;\r\n                &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\r\n                &lt;category android:name=\"android.intent.category.BROWSABLE\" \/&gt;\r\n                &lt;data android:scheme=\"@string\/fb_login_protocol_scheme\" \/&gt;\r\n            &lt;\/intent-filter&gt;\r\n        &lt;\/activity&gt;\r\n\r\n    &lt;\/application&gt;\r\n\r\n&lt;\/manifest&gt;\r\n<\/pre>\n<p>C. Now open your activity_main.xml file and add the below code.<\/p>\n<p><strong>Code: activity_main.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".MainActivity\"&gt;\r\n\r\n    &lt;TextView\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\"\r\n        app:layout_constraintVertical_bias=\".1\"\r\n        android:gravity=\"center\"\r\n        android:textColor=\"#3F51B5\"\r\n        android:textStyle=\"bold\"\r\n        android:text=\"TechVidvan Facebook Integration\"\r\n        android:textSize=\"30sp\"\/&gt;\r\n    \r\n    &lt;com.facebook.login.widget.LoginButton\r\n        android:id=\"@+id\/login_button\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_gravity=\"center_horizontal\"\r\n        android:layout_marginTop=\"30dp\"\r\n        android:layout_marginBottom=\"30dp\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\"\/&gt;\r\n\r\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\r\n<\/pre>\n<p>D. Now you need to browse your MainActivity.kt file and add the below code.<\/p>\n<p><strong>Code: MainActivity.kt<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.example.techvidvanintegrate\r\n\r\nimport android.content.Intent\r\nimport android.os.Bundle\r\nimport android.util.Log\r\nimport androidx.appcompat.app.AppCompatActivity\r\nimport com.facebook.CallbackManager\r\nimport com.facebook.FacebookCallback\r\nimport com.facebook.FacebookException\r\nimport com.facebook.login.LoginResult\r\nimport com.facebook.login.widget.LoginButton\r\n\r\n@Suppress(\"DEPRECATION\")\r\nclass MainActivity : AppCompatActivity() {\r\n    \/\/declaring variables\r\n    lateinit var callbackManager: CallbackManager\r\n    lateinit var fbLoginButton: LoginButton\r\n    private val email = \"email\";\r\n\r\n    override fun onCreate(savedInstanceState: Bundle?) {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_main)\r\n\r\n        \/\/binding the facebook login button with our variable\r\n        fbLoginButton = findViewById(R.id.login_button)\r\n\r\n        \/\/setting up on click listener on our fb login button\r\n        fbLoginButton.setOnClickListener {\r\n            fbLoginButton.setReadPermissions(listOf(email))\r\n            callbackManager = CallbackManager.Factory.create()\r\n\r\n            \/\/registering callback method over the fb login button\r\n            fbLoginButton.registerCallback(\r\n                callbackManager,\r\n                object : FacebookCallback&lt;LoginResult?&gt; {\r\n\r\n                    \/\/on successful login the below method will trigger\r\n                    override fun onSuccess(loginResult: LoginResult?) {\r\n                        \/\/displaying the facebook token generated for the user\r\n                        Log.d(\"TechVidvan\", \"Login Token: \" + loginResult!!.accessToken.token)\r\n\r\n                        \/\/redirecting him to new activity as he is successfully logged in\r\n                        startActivity(Intent(applicationContext, WelcomeScreen::class.java))\r\n                    }\r\n\r\n                    override fun onCancel() {\r\n                        \/\/ Define what to do if user rejects to log in using facebook\r\n                    }\r\n\r\n                    override fun onError(exception: FacebookException) {\r\n                        \/\/ Define what to do if there is some error while logging in\r\n                    }\r\n                })\r\n\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>E. Now, create a new activity called \u201cWelcomeScreen,\u201d where you will redirect to the user if he successfully logs in to your application. Add the below code in your activity_welcome_screen.xml file.<\/p>\n<p><strong>Code: activity_welcome_screen.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.constraintlayout.widget.ConstraintLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".WelcomeScreen\"&gt;\r\n\r\n    &lt;TextView\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\"\r\n        android:gravity=\"center\"\r\n        android:textColor=\"#3F51B5\"\r\n        android:textStyle=\"bold\"\r\n        android:text=\"Thanks for signing in!!\"\r\n        android:textSize=\"30sp\"\/&gt;\r\n\r\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\r\n<\/pre>\n<p>F. That\u2019s it. Your whole coding part is completed, and your application is ready to be tested.<\/p>\n<p>Now go ahead and run your Facebook Integration application on your android device or emulator.<\/p>\n<p>You can notice a button to continue with Facebook. Using this button, you can log in to the app by using your Facebook credentials.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_1-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84718\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_1-4.jpg\" alt=\"Facebbok Integration in Android App\" width=\"1080\" height=\"2280\" \/><\/a><\/p>\n<p>After you click on this button, it will take you to a page where you need to enter your Facebook credentials.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_2-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84719\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_2-4.jpg\" alt=\"\" width=\"1080\" height=\"2280\" \/><\/a> <a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_3-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84720\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/App_Output_3-3.jpg\" alt=\"\" width=\"1080\" height=\"2280\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>So through this article, you came across how you can add the Facebook sign-in feature to your android application. You can find this quite important because nowadays, people prefer signing in from either google or Facebook. So adding these options advances a high rate of users on your applications.<\/p>\n<p>From this article, I have tried to make every step clear for you, which would help you integrate Facebook into your app. Now it\u2019s time for you to self explore it and then leave your valuable comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will show you how you can allow Facebook integration in your apps. Imagine allowing users to access your application effortlessly by logging in through their Facebook account. With the widespread&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":84703,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2791],"tags":[4233],"class_list":["post-84487","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-facebook-integration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Facebook Integration - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn how you can allow Facebook integration in your Android apps. It enables users to access application just by logging in through Facebook\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Facebook Integration - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn how you can allow Facebook integration in your Android apps. It enables users to access application just by logging in through Facebook\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-10T03:30:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-05T16:32:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Facebook Integration - TechVidvan","description":"Learn how you can allow Facebook integration in your Android apps. It enables users to access application just by logging in through Facebook","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/","og_locale":"en_US","og_type":"article","og_title":"Android Facebook Integration - TechVidvan","og_description":"Learn how you can allow Facebook integration in your Android apps. It enables users to access application just by logging in through Facebook","og_url":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-09-10T03:30:48+00:00","article_modified_time":"2024-08-05T16:32:26+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Android Facebook Integration","datePublished":"2021-09-10T03:30:48+00:00","dateModified":"2024-08-05T16:32:26+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/"},"wordCount":1000,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg","keywords":["Android Facebook Integration"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/","url":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/","name":"Android Facebook Integration - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg","datePublished":"2021-09-10T03:30:48+00:00","dateModified":"2024-08-05T16:32:26+00:00","description":"Learn how you can allow Facebook integration in your Android apps. It enables users to access application just by logging in through Facebook","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/Facebook_Integration.jpg","width":1200,"height":628,"caption":"Android Facebook Integration"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/android-facebook-integration\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Android Facebook Integration"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=84487"}],"version-history":[{"count":1,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84487\/revisions"}],"predecessor-version":[{"id":447611,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84487\/revisions\/447611"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/84703"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=84487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=84487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=84487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}