Tip:
Highlight text to annotate it
X
Hi. I’m Cheng from the bada team at Samsung. In this video we will explain how BuddyFix
lets you share your location with your Facebook friends.
BuddyFix is our open source, location based, social networking application.
In the first video in this series we introduced the Social::Services namespace and explained
the features provided by the bada server: such as profiles, privacy, the Buddy Service
and messaging. We also talked about using the SnsGateway to communicate with your friends
on Facebook and Twitter. Then we looked at how messages are sent and
received and how BuddyFix displays the last message from a user, together with their location
on the map. In this final BuddyFix developer video we’ll
take a detailed look at how BuddyFix uses the SnsGateway. We’ll show you the code
for authenticating BuddyFix with Facebook, how to get your friend’s profile information
and how to post your location on their wall. As we explained in the first video, the SnsGateway
allows you to create applications that can communicate with 3rd party social networking
services such as Facebook or Twitter. You write code to use bada’s Sns APIs and don’t
have to deal with the low level details of communicating with the service. Let’s see
how BuddyFix uses these APIs. In BuddyFix we have a class called SnsManager
which manages social networking accounts. Notice that it derives from the various Sns
listener classes so it gets to handle SnsGateway related events.
In our Construct method we create objects of two important classes in the Social::Services
namespace. SnsAuthenticator is used to authenticate an application with a service provider, while
SnsGateway provides the code for communicating with the service, including such features
as getting profile information and photo albums. In BuddyFix we have a setting which allows
the user to enable Facebook integration. Once this is enabled, you’ll be able to import
your Facebook friends’ profiles into BuddyFix and share your location with a single click.
Our SignIn() method is used to authenticate the user’s Facebook account. A user’s
login credentials are stored for around 2 weeks, so they might already be logged in.
If they’re not logged in, we call the Authenticate() method which displays the Facebook login page
in a browser. consumerKey and consumerSecret are the unique
keys which we obtained from Facebook to authenticate BuddyFix. If you're writing your own application,
you’d need to get your own consumerKey and consumerSecret.
Once the user is logged in to their Facebook account, they can import their Facebook friends’
profiles into BuddyFix. We use our RequestExistingBuddies method to
get a list of the current user’s Facebook friends. We call the SnsGateway method GetMyBuddies
asking for 16 profiles per page to be returned. These profiles wil be returned in the ISnsPeopleListener
method. The list of Facebook profiles is received
in our implementation of the OnMySnsBuddiesReceivedNMethod. We get sent a list of SnsProfiles and from
this we can various elements of profile information. Using the SnsProfile GetValue method we can
get the user’s first and last name and profile pictures from the social networking site,
in our case Facebook. We then use this information to construct our MyBuddy type object.
Once the user’s Facebook contacts are imported, they can share their location by posting to
their friend’s Facebook wall. We post a message consisting of a Google Maps URL with
our current location. We set up a SnsPostInfo object with the message
containing the Google Maps URL and the targetID, which in our case is the user’s Facebook
id. We then call the SnsGateway method PublishPost to write to their wall.
In this video we showed how BuddyFix uses bada’s SnsGateway to import profile information
from Facebook and to post a message containing a user’s location on their friend’s Facebook
wall. If you’ve missed the earlier BuddyFix developer
videos, be sure to check them out on YouTube. Thanks for watching. Why not download the
BuddyFix code today and use it in your own application?