How to use Phonegap Facebook Plugin for Android (Cranberry's Plugin)




5,523 visits, 11,383 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.


If you try building it under Android now, you will get an error, so don't. We are not done with this yet. So now before building, we need to change few attributes. So CHECK THIS

Under the //Phonegap Facebook, copy the content which is after the arrows (==>) like shown in the image below.

and now go to Intel XDK window, Under Develop Tab, on the left side choose intelxdk.config.additions.xml and paste it as shown in the image below.

Now in this above newly pasted content,

Instead of 'YOUR_FACEBOOK_APP_ID' Tag paste your App ID from FB - You should get this in Facebook Setting Tab

Instead of 'YOUR_FACEBOOK_APP_NAME' Tag paste you App Name from FB - You should get this again in Facebook Setting Tab.

Before leaving this DEVELOP tab, Click FILE and SAVE to keep your changes in this XML.


Now switch to BUILD Tab --> Under CORDOVA 3.X HYBRID MOBILE APP PLATFORMS --> Select Android Build.

Wait for the Intel XDK to upload the project and then again CLICK BUILD APP NOW (The Big Green Button on the right side).

And the build should be successful now. As you have registered and logged in to the Intel XDk, you will receive a mail, access the mail through your phone, download the apk, install and run it. Now, test every option in that app such as Log in, Log out, Check is user login?, Post in wall, Prompt to share an app and many more.


This is a simple method, may confuse at the beginning, but it is very very easy. The example capx itself is easy to understand. Have a look at the events in the capx, it is quite understandable. This is my first tutorial and if is anything wrong or any questions you wanted to ask, kindly post it below. Thanks a lot to everyone in this community and a special thanks to @Cranberrygame for this Plugin (should check these plugins in this LINK).

Hope it helps. :D


  • Order by
Want to leave a comment? Login or Register an account!