BT

Facebook Releases PhoneGap Plugin and SDK for .NET

by Anand Narayanaswamy on Apr 23, 2013 |

PhoneGap Facebook Plugin enables developers to use a modified version of Facebook's web SDK and maps certain calls to the native Facebook iOS and Android SDKs. It provides an ability to use the installed Facebook app for single sign-on instead of navigating through the device browser. Moreover, developers only need have to use the same JavaScript code similar to that of a web application.

In order to work with the plugin, you have to register your app with Facebook and obtain an APP_ID from the Facebook App central. Moreover, you have to set up your native iOS App settings on the Facebook App dashboard if you intent to make use of the plugin with iOS. For Android, you will be required to generate a hash of your Android key(s) and submit those to the developers page on Facebook.

If you are using the plugin manually then create a basic Cordova Android app by setting the Min target to 8, which can be edited in your Android manifest file.

(1) Add the following code in your res/xml/config.xml file as a child to the plugin tag

<plugin name="org.apache.cordova.facebook.Connect" value="org.apache.cordova.facebook.ConnectPlugin" />

(2) Install the Facebook SDK for Android and the Facebook APK, Import the Facebook SDK into Eclipse and link the Facebook SDK library to your project.

You need to add a new com.facebook.LoginActivity activity to your app to handle Facebook Login by opening AndroidManifest.xml file and provide the following code

<activity android:name="com.facebook.LoginActivity"
android:label="@string/app_name" />


(3) Copy ConnectPlugin.java (Cordova Facebook Plugin folder) from src/android/ folder to src/org/apache/cordova/facebook/ (root folder of Cordova Android application)

(4) Copy the www/cdv-plugin-fb-connect.js, www/facebook_js_sdk.js and example/HackBook/ files to assets/www folder.

(5) Finally, replace your appId in the new index.html file.

After the completion of all the above steps, you can create your application and run it from either the command line or from Eclipse.

The official documentation provides the steps required to create iOS app using the plugin in addition to a detailed coverage of the usage of included samples.

PhoneGap Facebook Plugin includes three sample apps that demonstrates the usage of Facebook APIs. Scrumptious is a new app introduced with this release, which interacts with Facebook's Open Graph and requires setting up a web server to handle open graph objects.

Facebook has announced the availability of a C#/XAML based Facebook SDK for .NET that enables you to integrate Windows Phone and Windows 8 style apps with Facebook. The SDK is part of the Facebook Technology Partners program and is released as an open source project by Outercurve Foundation, which provides tutorials for both Windows Phone and Windows 8, and has links to the GitHub repository where the source is hosted.

"An added benefit of using this SDK is that it provides very similar APIs on both the Windows Phone and the Windows 8 platforms, so code-sharing between the two platforms becomes very easy," said Sanjeev Dwivedi, a developer evangelist for Microsoft working with Facebook.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT