Facebook Cordova Integration - aaccurso/CostSplitter GitHub Wiki
Prerequisites: FB App created with Website and Android platforms added to its configuration.
Based on phonegap-facebook-plugin guide release 0.4.2.
First add the plugin with cordova cli:
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git#0.4.2 \
--variable APP_ID="<your_facebook_app_id>" \
--variable APP_NAME="<your_facebook_app_name>"
How to add specific release of a plugin.
Open \plugins\com.phonegap.plugins.facebookconnect\plugin.xml and replace this:
<preference name="APP_ID" />
<preference name="APP_NAME" />
with this:
<param name="APP_ID" value="<your_facebook_app_id>" />
<param name="APP_NAME" value="<your_facebook_app_name>" />
Build Android application:
cordova platform add android && cordova build android
Generate a hash-key of your debug.keystore with password 'android' (required):
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore \
| openssl sha1 -binary | openssl base64
Copy the key and paste it under your FB app Android configuration in the 'Android Key Hash' section:
Add this into www/config.xml widget tag:
<feature name="org.apache.cordova.facebook.Connect">
<param name="android-package" value="org.apache.cordova.facebook.ConnectPlugin" />
</feature>
TODO:
- Add cdv-plugin-fb-connect.js to index.html
- Explain if CDV else end
- Integration with angular-easyfb
Facebook APK installation is only applicable if you are using the emulator to test the app
-
Download and install Facebook SDK: https://developers.facebook.com/docs/android/getting-started#install
-
Install Android plugin for Eclipse (yes, it's necessary to install Eclipse): http://developer.android.com/sdk/installing/installing-adt.html
-
Import FB SDK and your Project into Eclipse.
-
Link FB SDK to your Project. Go to Properties -> Android -> ( Library -> Add -> FacebookSDK ) -> OK
-
Update facebook sdk project:
android update project -p $FACEBOOK_SDK/facebook
-
Add this to app's AndroidManifest.xml:
<activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" />
-
IMPORTANT: Remove com.facebook.android from project /src.
-
Run as Android App from Eclipse.
TODO: script or grunt task (on root directory) with
cordova prepare android && cd platforms/android && ant clean && ant debug install
(redirect output to log file)
https://developers.facebook.com/docs/android/getting-started#login