Visual Studio 2010!

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Using Facebook's Graph API in Windows Phone Silverlight Development
By DevSource

Rate This Article: Add This Article To:

Learn how to integrate Facebook's Graph API into your Windows mobile Silverlight applications in this article with code samples from Dot Net Slackers.

To view the full article in its entirety, please visit eWeek: wFace – windows phone 7 facebook integration part 2

Retrieving data
Our next step is to retrieve data from Facebook. The page loaded handler already enables the buttons when we are logged in, so we can focus on handling the button events.

Let's start with the LoadUserData button.

In the Facebook graph_API documentation (http://developers.facebook.com/docs/API) we learn that:

All responses are JSON objects. We'll discuss this later. All objects can be accessed in the same way Objects are connected via relationships There is a special object named "me" Let's take a closer look at point 2. The examples show links like https://graph.facebook.com/btaylor or https://graph.facebook.com/25190... This means we have to provide a name or an ID to access objects.

And for point 3 we have links like https://graph.facebook.com/btaylor/friends. In simple words: these "relationships" are something like the basic object link followed by a "subdirectory" which provides the subject we want to access.

Last not least (for point 4) the name (ID) of the object (as in point 2) can be replaced with the special name "me". In this case we get access to logged in account. This will mostly be our favorite object, since the user gave us (our Facebook application) access to his elements.

Finally point 1 tells us that we will get all data as "JSON objects". JSON is a common format specification to transfer (store) objects. WCF services are also capable to communicate using JSON formatted data. The good old ASP.NET Webservices used SOAP, an XML based format which produces (in most situations) dramatically more "noise". So the overhead is much bigger than with JSON.

There are also other formats like BSON or simply binary transfer - but that is a different story.

Let's focus on JSON. And the best way to do this is best done by looking on what's going on.




Discuss Using Facebook's Graph API in Windows Phone Silverlight Development
 
>>> Be the FIRST to comment on this article!
 

 
 
>>> More ASP and .Net Coding Techniques Articles          >>> More By DevSource