Facebook Integration

Estimated reading time: 2 min

This link will take you to the Facebook Developer Console. After login with your Facebook account you will get a screen mention below.

Enter your project name into the Edit Text Field and click Create New Facebook App ID. You will get a screen like this.

Skip that Import SDK Step and jump to Add SDK and copy that Facebook app ID and keep it safe.

In the Android Project section paste your application package name in package name text field and your (application package name)+.activities.SplashScreen in you Default Activity Class Name text field and click Next.

In the next step you need to generate a key hash. Keep in mind there are two methods for generating the developmental key hash and release key hash.

Key Hash For Windows

In order to generate the key hash first you need to download the OpenSSL(for windows) tool. To download that for windows go to this link below.

Download OpenSSL tool compatible with your system and extract it to C:\OpenSSL.
Next you need to find the path of debug.keystore file in the C drive usually it is placed in the C:\Users\YOUR_NAME\.android folder.
Now open the Command Prompt. and execute the following command.

Note: For Debugging (use it for development purpose only.)
keytool -exportcert -alias androiddebugkey -keystore “C:\Users\YOUR_NAME\.android\debug.keystore” | “C:\OpenSSL\bin\openssl” sha1 -binary |”C:\OpenSSL\bin\openssl” base64
Note:For Publishing use this command
keytool -exportcert -alias “aliasName” -keystore “keystoreFilePath” | openssl sha1 -binary | openssl base64M

Note: remember to change the path to you debug.keystore file. and make it sure to use the OpenSSL folder name same as you created in the C drive.
when you press enter this will get a password. If you do not create a new password, then default password will be android

Key Hash For Mac

Please follow below mention steps to get hash key for mac OS

First open a terminal (open a command prompt in windows).

Navigate in the terminal to the directory where your Android debug.keystore is stored. Mostly it will located under /Users/user_name/.android/

Once you are in the “.android” directory, run the following command. keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64

When it prompts you for a password, type android and hit Enter

Copy the value printed in the terminal that ends with an = and paste it in the Key Hash field in Facebook. Then click the Save Changes button.

This is your key hash save it to your file and use it in developer Facebook console.
Now paste the application key to the android studio project file shown below as facebook_app_id. (res > values > strings.xml)

Now to get fb_login_protocol_scheme first go to your facebook app settings and in facebook login section select Quickstart and then select android

In the Edit Your Resource and Manifest section you can get fb_login_protocol_scheme. Just copy and save it.

Was this article helpful?
Dislike 0
Views: 104

Continue reading

Previous: Setting Consumer Key & Secret Key
Next: Google Integration