Tutorial - Phonegap Facebook Plugin - Android (Cranberrygame's Plugin)

Favourite 14 favourites
Tutorial written by MadrasmadnesOriginally published on 25th, December 2014 - 2 revisions


This easy step by step tutorial is only for Beginners and for those who are fighting with errors for Facebook Integration. So this could be a start. Once you test it out successfully, you can play with it and also try using Facebook features in your games.
Outcomes of this tutorial is with the sample capx which is provided in the below link, you can test it in your real mobile device, you can LOG IN, LOG OUT, SHARE, POST and many more features. So, once again this could be a real good start for beginners. All the best and let's get it started.

Plugin: Phonegap Facebook. DOWNLOAD HERE
ZIP FILE CONTAINS plugin files, sample capx and readme.


First, we have to create a test app in Facebook. There are few detailed tutorials out there in this forum where you can learn more about this Facebook developer settings and all. But for now we don't need much. So, go to Facebook Developer Log-in Page First you log in with your Facebook account. Then click on APPS --> Add a New App

In the select the platform section --> Select Android.
Open full size image

In the Quick start for Android section select --> SKIP and CREATE APP ID
Open full size image

Now, in the Create a New App ID section, Give any "display name", Select "Category", "Sub-Category" and Click Create App ID.
Open full size image

Then, Under Setting Tab --> Basic --> Click on +Add Platform
Open full size image

From the given list of "Select Platform" select ANDROID

For temporary just paste this below quoted text in the Key Hashes without the Quotes "AAAAAAAAAAAAAAAAAAAAAAAAAAA="

Just click on "Save Changes" and then go to Status and Review Tab. Now Enable the live feature availabel to general public as shown in the below image.
Open full size image

NOTE: If you don't enable the Live feature available to the general public option in the Status and Review Tab, you cannot able to log-in with any other Facebook account other than the one which you use now to create this test app. So make it Live and Public.

Okay. For now, we are done with the Facebook, so let's move on to the next part "Example Capx"

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.


Donald Cela 3,964 rep

when i try to build on xdk , it gives me an error :
Error: Could not retrieve plugin "github.com/cranberrygame/cordova-plugin-share-facebook --variable APP_ID='xxxxxxxxxxxxxxx' --variable APP_NAME='my app name'".
Error: Could not fetch plugin "github.com/cranberrygame/cordova-plugin-share-facebook --variable APP_ID='xxxxxxxxxxxxx' --variable APP_NAME='my app name'".

any idea how to fix ?

Sunday, July 03, 2016 at 6:11:26 PM
signupdemo 741 rep

XDK gives the error while installing cranberry facebook plugin, I tried with XDk featured facebook4 plugin, it works fine, but I can't seem to get the "prompt to share link" or any other prompt action to work ?

Thursday, September 15, 2016 at 7:43:15 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.