Facebook App Tutorial
  1. Go to https://developers.facebook.com/ and click Log in.


  2. Once logged click My Apps then Create App button. A popup will show. Type in a Display Name and Contact Email. Contact email is provided as default. Once done click, Create App ID button.


  3. Once done, in the left panel select Settings > Basic and type in Privacy Policy URL and also select for App Category on the right. Once done, tap the Save Changes button on the lower right.


  4. In the upper right, tap the switch OFF and a popup will show. and tap Confirm button. Now your app is accessible to public.


  5. Copy the App ID and App Secret. App Secret will only be revealed once you tap the Show button and it requires login. You will be needing this later.


  6. On the left pane, Click Products then select Facebook Login and tap the button Setup below.


  7. Just tapped Next button until you reached at Tell Us about Your Android Project

    Add a package name and the main activity name. Usually if you rename the package name to com.mycompany.myapp, you just need to append the MainActivity at the ending.

    So package name will be: com.mycompany.myapp, then

    Default Activity Class Name will be: com.mycompany.myapp.MainActivity

    After it, tap Save button and proceed to Next


  8. You need to enable Single Sign On as shown below. It can be found under Settings > Basic


  9. Go to your project in Android Studio. Navigate to res > values > strings.xml. Look for facebook_app_id and change the value.


  10. The Facebook App Id is found at the upper left corner next to View Analytics as shown below


  11. In Android you need keyhashes in order to work. The steps are provided below, Copy the Code and Open your Terminal and paste it inside.

    Development Key Hash is easy as it is defaul one. The Release need to have the Keystore you will be using on exporting APK file.

    For the Development Keyhash: (On OS X)

    keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

    For the Development Keyhash: (On Windows)

    • Download Key and Certificate Management Tool (keytool) from the Java Development Kit
    • OpenSSL for Windows Library from the Google Code Archive
    • Then run the following command in a command prompt in the Java SDK folder:

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

  12. Once your app is ready for publishing, it needs a release keyhash in order for the facebook login to work. To get it, follow the steps below

    For the Release Keyhash: (On OS X)

    keytool -exportcert -alias -keystore | openssl sha1 -binary | openssl base64

    For the Release Keyhash: (On Windows)

    • Download Key and Certificate Management Tool (keytool) from the Java Development Kit
    • OpenSSL for Windows Library from the Google Code Archive
    • Then run the following command in a command prompt in the Java SDK folder:

      keytool -exportcert -alias -keystore | PATH_TO_OPENSSL_LIBRARY\bin\openssl sha1 -binary | PATH_TO_OPENSSL_LIBRARY\bin\openssl base64

    Make sure to use the password that you set when you first created the release key.

    This command should generate a 28 characher string. Copy and paste this Release Key Hash into your Facebook App ID's Android settings.


  13. That's all. You are done. Congrats.


Next >>