Android Gets Facebook Graph API Before the iPhone

Facebook announced new mobile social networking functionality for the Android platform this week. At Google I/O, Google’s developer conference, executives routinely made fun of Steve Jobs and Apple, but Facebook’s role in the drama was overlooked by the press. Facebook’s mobile development team soft launched a Facebook SDK for Android, bringing functionality that was previously only available on the iPhone to the Android platform. It gets better: Facebook gave the Android platform a de facto exclusive on two of its newest initiatives: Open Graph APIs and OAuth 2.0.

Facebook at Google I/O Developer Conference

I chatted Charles Wu, Facebook’s program manager for mobile, at Google’s Developer Sandbox. Steven Soneff, a Stanford Graduate student intern for Facebook, also gave me an in depth technical walk through of his work on the Android developer tool.

Facebook’s Goal At Google I/O

Facebook’s goal is to find interesting game and app developers to try out the new Android SDK. Facebook is showing select developers their vision of where they are going on Android. When Facebook gets developer feedback, they will massage the new technology. Once Facebook is satisfied that people are happy with their new Android developer tools, they will open it up as an official SDK.

Facebook’s Software Developer Kit (SDK) for Android

Facebook’s SDK for Android is like the Facebook SDK for the iPhone, but better. Its more advanced, implementing Faceboook’s newly announced Graph API and other new features like deep linking. Facebook’s goal is to make it easy for developers to put Facebook in their app, using a native SDK for Android.

You can drop in a Connect button in your application, and authenticate users with OAuth 2.0 – then your app can access Facebook’s new Open Graph initiative.

Data privacy issues are reduced, because you users are logged into Facebook and you access their permission settings.

Its clear to users what’s happening, because they actually switch back and forth between your app and the Facebook for Android app when accessing core Facebook features.

Facebook highlighted three things about its Android developer tool:

  1. Authorizing users with OAuth 2.0
  2. Calling to Facebook APIs from Android
  3. Deep linking between apps and Facebook

OAuth 2.0 User Authentication

The Facebook SDK encapsulates OAuth’s complicated authentication process.

For developers, it looked pretty simple to create and store an authentication token with the new SDK.

For app users, it was completely seamless – happening behind the scenes when they clicked a Facebook Connect button.

The programming process for Java programmers:

1. Instantiate a Facebook object
2. Authorize the Facebook object
3. Get an authorization token
4. Make requests using the token

Calling Facebook APIs from Android

The Facebook Android SDK creates Android “wrappers” for existing web services – Facebook’s RESTful APIs, and Open Graph APIs.

Developers can do anything they like with the new Graph API. Also, all the usual Facebook API calls app developers use to make apps on also work on Android devices – like the API calls to get friend lists, make wall posts and publish into a user’s stream on Facebook.

Deep linking to Facebook on Android

Facebook now lets Android app developers link deep into Facebook apps. This means that Android apps can create a seemless experience integrating their apps and Facebook, directly accessing specific parts of a users Facebook app, deep within the Facebook app’s navigation.

Example of deep linking into Facebook Apps:

If a user is playing a game and wants to check out another player’s Facebook profile – they simply click a button and the profile page displays on their phone. The users do not have to navigate within their Facebook app to find the right information, it simply appears.