X
    Categories: Advanced

Android Facebook Based Login Tutorial Part – 1

 

Android Facebook login :

We deal with several apps everyday and cannot remember all their login credentials so to avoid several login there is a was by which we can login into app using facebook login, so adding a facebook based login is an added advantage lets start this android tutorial on facebook login to know more about this topic.

Facebook login tutorial will guide you how to make login in you android app based on your facebook id.Not only login but there are several other feature using facebook sdk we can integrate into our app like analytics, like, share and ads.

Previously we had made login based on user registered values but now we will look into a different type of login which is much flexible and easy for users and also for developers to authenticate.

 

 

For second part of tutorial visit

https://androidcoding.in/2016/06/27/android-facebook-based-login-tutorial-part-2/

 

Firstly we will create app id, to begin with

Facebook Developer site : https://developers.facebook.com/

Then select android app from available options

 

Creating App Id

 

 

 

 

 

 

 

 

 

 

Then create app id

 

 

Then in product setup select facebook login as we require it

 

 

Then enter your package name

 

 

 

 

 

 

 

 

 

Then import facebook sdk into Android studio project

implementation 'com.facebook.android:facebook-login:latest.release'

 

Now generate hash code by using the below command

 

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore |
 openssl sha1 -binary | openssl base64

 

Now enter generated key hash

 

 

 

 

 

 

 

You can see your app id here

 

 

 

 

[/et_pb_text][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

Now add facebook app id in your string.xml

<string name="facebook_app_id">1170716273295079</string>
<string name="fb_login_protocol_scheme">fb1170716273295079</string>

 

Can visit this site for reference

 

Now add Internet Permission

<uses-permission android:name="android.permission.INTERNET"/>

 

Now add Meta data in manifest file 

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

 

Then add Facebook Activity in the android manifest file.

<activity android:name="com.facebook.FacebookActivity"
android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" /> 

<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>


As to make tutorial much easier i am dividing into two parts so that it can be easy understand.

If you have any query’s in this tutorial on android facebook do let us know in comment below.If you like this tutorial do like and share us for more interesting updates.

 

For second part of tutorial visit part 2

 

 

abhishek:
Related Post

This website uses cookies.