Game Development Reference
In-Depth Information
The following example code shows a sample callback function and how to use it with
the s3eFBSession_Login function:
// Login callback
void LoginCallback(struct s3eFBSession* apSession,
s3eResult* apLoginResult, void* apUserData)
{
if (*apLoginResult == S3E_RESULT_SUCCESS)
{
// Logged in OK
}
else
{
// Login failed
}
}
// Log in to Facebook using the session returned from s3eFBInit.
const char* permissions[] = { "publish_stream" };
s3eFBSession_Login(lpSession, LoginCallback, NULL,
permissions, 1);
This code attempts to log in to Facebook requesting the publish_stream permission
that allows an application to post to a user's wall.
When a Facebook login attempt is made, our application will lose focus and the
device's Facebook application will be started. If the user doesn't have a Facebook
application installed, the device's web browser will be launched instead.
You will be asked to provide your Facebook account's login details, so for testing
purposes enter the details for one of the test user accounts we generated earlier. Once
logged in, another screen will appear detailing what our application wants to do
with the user's Facebook account. In the previous example this would just be posting
to the user's wall. If the Facebook App has not yet been authorized for the Facebook
account, the screen will also have two buttons labeled Allow and Don't Allow ,
which the user can use to grant or disallow access respectively.
The Facebook login process will first look to see if a user is already
logged in to Facebook by looking for a browser cookie, and will
not ask for username and password details if this is the case. If the
test device is also your own personal device, you will probably
want to log out of Facebook before testing your application to
avoid annoying those on your friends list!
 
Search WWH ::




Custom Search