A starting project for Ionic that supports authentication with native facebook integration
phonegap facebook plugin available at phonegap-facebook-plugin
When you try to install this plugin in a normal cordova project , you will encounter a lot of build errors. Now if you manage to add this plugin successfully you will have a lot of runtime errors to deal with. At least I never got it working and so i think did many people out there.
The folks over here wrote this life saver of a command line process that saved my day. So whatever goes forward is a repetition but specific to this project. (The steps below are for ionic and android. The ios version works with a regular plugin add)
-
Checkout this project
-
ionic platform add android
-
cordova -d plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="YOUR_APP_ID" --variable APP_NAME="YOUR_APP_NAME" (replace the app_id and app_name with an app that you have created on facebook)
-
android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib"
-
android update project --subprojects --path "platforms/android" --target android-19 --library "com.phonegap.plugins.facebookconnect/FacebookLib"
-
cd platforms/android/
-
ant clean
-
cd com.phonegap.plugins.facebookconnect/FacebookLib
-
ant clean
-
open -e AndroidManifest.xml (It worked without this for me) // change your minSdkVersion and your targetSdkVersion to your environment settings for me it was: //
-
ant release
-
cd ../../../.. (this should bring you back to the project root)
-
ionic build android
Configure your keyhash on the facebook app (step 3).
There are still bugs on the plugin for android when we remove the app from the permissions list, which already has a patch.