Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 3.32 KB

File metadata and controls

68 lines (54 loc) · 3.32 KB

#Facebook SDK Beta for Cocos2d-JS API Reference

##Getting start

Before using Facebook SDK Beta, you may need to integrate Facebook SDK Beta for Cocos2d-JS in your project. Firstly, please use Cocos Console to create a new project, then follow these documents for the integration:

##API list

###FacebookAgent class

plugin.FacebookAgent is a singleton class that encapsulates the methods of Facebook SDK Beta for Cocos2d-JS. Before doing anything else, you need to initialize the instance first.

###Core Methods

Name Description
getInstance Initialize the SDK, and return the instance of plugin.FacebookAgent. Required before doing anything else.
destroyInstance Destroy the instance of plugin.FacebookAgent.
api Call the Facebook Graph API to find out about the user or act on his/her behalf.
share Post a status update on Facebook.
dialog (for sharing) Trigger the Facebook Dialog for sharing.
dialog (for sending messages) Trigger the Facebook Dialog for sending messages.
appRequest Trigger the Request dialog for one-to-one sharing.

###Auth and Session Methods

Name Description
login Ask a user to authorize your app, or to grant additional authorizations.
logout Log a user entirely out of Facebook.
isLoggedIn Check whether a user is currently logged in and has authorized your app.
requestAccessToken Get the access token granted to your application by current user.
getPermissionList Get the access token granted to your application by current user.

###Auxiliary Methods

Name Description
pay Prompt the user to make a payment using Facebook Payments. Desktop only.
activateApp Report an install, for integration with Mobile Install Ads. Mobile only.
logEvent Publish an app event, for deeper integration with Mobile Install Ads. Mobile only.

##Facebook SDK Beta Features

Methods iOS Android Web
api
share
dialog - share_link
dialog - share_photo ×
dialog - share_open_graph
dialog - message_link
dialog - message_photo ×
dialog - message_open_graph ×
appRequest
login
logout
isLoggedIn
requestAccessToken
getPermissionList
pay × ×
activateApp ×
logEvent ×