Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Facebook integration with PhoneGap

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 686
    Comment on it

    Hi All,

    In this blog post we are going to discuss how to integrate Facebook with PhoneGap.

    To integrate Facebook with Android you need to register your app with Facebook first.

    To register your App with Facebook follow below steps:

    1. Navigate to https://developers.facebook.com/

    2. Log in with your Facebook Account.

    3. Click on my Apps
    alt text


    4. Add a new Application

    5. Select a platform to get started. In this case we will select Android
    alt text


    6. Click on Skip and create App Id.

    alt text

    7. After fill Display Name,Name Spaces and category you can get your app Id and App Secret. Copy App Id for future Use.

    alt text


    alt text


    8. After getting App Id click on Settings on left side Menu.

    alt text

    9.Click on Add Platforms.

    alt text

    Fill form with:

    I. Google play package Name:Unique app identifier used to open your App For ex: com.app.xyz

    II. Class Name: The main activity you want Facebook to launch
    For Ex: xyz

    alt text

    III. Key Hashes: To generate Key Hashes write following code on your main java class of your app:

     try {
                   PackageInfo info = getPackageManager().getPackageInfo("com.app.myApp",          PackageManager.GET_SIGNATURES);
                  for (Signature signature : info.signatures){
                   MessageDigest md = MessageDigest.getInstance("SHA");
                   md.update(signature.toByteArray());
                   Log.d("KeyHash:", Base64.encodeToString(md.digest(),Base64.DEFAULT));
     }
                }
            catch (NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    } }

    Import Following packages:


    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import android.content.pm.PackageInfo;
    import android.content.pm.PackageManager;
    import android.content.pm.PackageManager.NameNotFoundException;
    import android.content.pm.Signature;
    import android.util.Base64;
    import android.util.Log;
    

    Run your application and copy Key Hashes from console and fill it into form.


    10. Click on App Details option on the sidebar and add the relevant information about the app.

    11. Turn on the App Center Platform settings for your mobile/web site to list your app in app center.

    12. Add icons, images, and videos as specified in the settings page. The images and icons need to be of the mentioned size and resolution.

    alt text
    alt text

    After the app registration is done you need to upload the APK for your app and submit it for review to Facebook team. It takes 5 business days for the team to approve your app.you can start using the App ID generated to implement Facebook functionality in your app before approval as well.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: