Facebook Class
This class provides access to Facebook Connect. It class allows a user to login, logout, post messages, pictures, retrieves status, friends etc.
Item Index
Methods
this
appIdpermissions
Parameters:
-
appIdString= "" The Facebook application identifier.
-
permissionsArray= null The list of strings of required permissions.
Example:
var facebook = new Facebook("", ["offline_access", "status_update", "read_stream", "publish_stream"]);
var facebook = new Facebook("288852541221599", ["offline_access", "status_update", "read_stream", "publish_stream"]);
dialog
urlparams
Displays a Facebook UI dialog for publishing posts to a user's stream. This is very easy way to post any data to user's wall.
Parameters:
-
urlStringURL to be used in Dialog.
-
paramsObject= null The parameters in JSON object to be sent to Dialog.
Example:
facebook.dialog("feed", {caption: "Moscrif Test.", link: "https://moscrif.com", picture: "https://moscrif.com/images/logo.png", actions: {name: "Moscrif Test", link: "https://moscrif.com"}, description: "Moscrif test."});
isAvailable
() static
Returns true when Facebook Connect is supported, otherwise false.
login
()
Prompts the user to login to Facebook.
logout
()
Logs out user from Facebook Connect.
request
pathmethodparams
Get or post data to the logged in Facebook account.
Parameters:
-
pathStringThe Graph API endpoint.
-
methodSymbol= #get The HTTP method, can be #get or #post.
-
paramsObject= null The parameters in JSON object to be sent to Facebook. For more information visit .
Example:
facebook.request("me");
facebook.request("me/friends", #get);
facebook.request("me/picture", #get, {redirect: false, type: "large"});
facebook.request("me/feed", #post, {title: "Moscrif Test", type: "status", message: "Moscrif Test.", description: "Moscrif test."});
facebook.request("me/feed", #post, {title: "Moscrif Test", type: "link", link: "https://moscrif.com", picture: "https://moscrif.com/images/logo.png", description: "Moscrif test."});
var bitmap = Bitmap.fromFile("app://foto.jpg");
facebook.request("me/photos", #post, {title: "Moscrif Test", source: bitmap, message: "Moscrif Test.", description: "Moscrif test."});
Events
onDialog
Called when dialog has been returned successfully.
Event Payload:
-
urlStringThe response in url format.
Example:
facebook.onDialog = function(url)
{
logI("onDialog : ", url.debugShow());
}
onDialogFailed
Called when dialog has been failed.
Event Payload:
-
errorStringReason of failure.
Example:
facebook.onDialogFailed = function(error)
{
logI("onDialogFailed : ", error.debugShow());
}
onLogin
Called when the user has been successfully logged in.
onLoginFailed
Event Payload:
-
errorStringReason of failure.
onLogout
Called when the user has been successfully logged out.
onRequest
Called when request has been returned successfully.
Event Payload:
-
dataObjectThe response in JSON format.
Example:
facebook.onRequest = function(data)
{
logI("onRequest : ", data.debugShow());
}
