Release Notes: (1.7.2)
  • Fixed a crash on arm64 devices occurs in _em_FacebookSNS_Init().
  • Updated patcher that supports latest Xcode, avoid some errors while compiling on Xcode 6.3+.
  • Resolved build errors regarding missing __bridge cast when compiling on Xcode 6.3+.

Integration Guide - Facebook SNS Plugin

Platforms: Android & iOS
Plugin version: 1.7.2
Facebook iOS SDK version: 3.22
Facebook Android SDK version: 3.22

IMPORTANT RELEASE NOTE:

· >>> For Apps that created on Facebook later than April 30, 2014, developer should upgrade to plugin version 1.6.0 or above immediately, since the newly created Apps are only allowed to access Facebook Graph v2.0. Learn more...


There are a number of important changes in Graph v2.0 that you should realize:


· Permissions are now optional to people using your app.

· Friend list is no longer part of the default permission set and has its own permission.

· Friend list now only returns friends who also use your app.

· The default permission set called "basic info" has been removed, and replaced by "public profile".

· Facebook will review how apps use Facebook Login.

· And more...

NOTE: The new Facebook Login and the announcements here are available to all new apps starting April 30, 2014 while existing apps have a full year to upgrade (April 30, 2015). In our plugin the Graph API to access has been defaulted to version 1.0 for existing Apps (created prior to April 30, 2014), and it will request v2.0 starting April 30, 2015 automatically.

Generally you don't have to dive into the documentation from Facebook, simply follow a few steps below to get the plugin integrated in your App in minutes:

PREPARATION:


   IMPORTANT FOR LEADERBOARD:

· >>> If you intend to publish scores or achievements to facebook, please set up your App as a "Game" at Facebook Dev Site before integrating. Just click on "App Details" link on the left menu in the selected App page, make sure your App is categorized as Games.


   iOS PLATFORM SPECIFIC SETTINGS:

· >>> In your iOS platform Settings, fill in "Bundle ID", "iPhone Store ID" and "iPad Store ID".

· >>> In your iOS platform Settings, turn on "Single Sign On" and "Deep Linking".


   Android PLATFORM SPECIFIC SETTINGS:

· >>> In your Android platform Settings, fill in "Package Name" with the "Bundle Identifier" of your game.

· >>> In your Android platform Settings, fill in "Class Name" with this: com.neatplug.u3d.plugins.common.NPUnityPlayerActivity.

              (If you need to integrate it with Vuforia AR, please take com.neatplug.u3d.plugins.common.NPQCARUnityPlayerActivity instead).

· >>> In your Android platform Settings, add in "Key Hashes" with the keyhash we compute for you in step [3].


   OTHER NECESSARY SETTINGS:

· >>> If you need to send [Invites] or [App Requests], in your App on Facebook platform settings (you need to add it if the platform is not there), make sure you have your "Canvas URL" and "Secure Canvas URL" filled in.

[1] Import the FacebookSNS[Android|IOS|Universal].unitypackage file to your unity project;

[2] Follow the instructions below to configure the plugin.

· >>> For Android platform, click on the menu item of Unity top menu bar: NeatPlug -> FacebookSNS -> Patch Android Configuration. This is for generating a valid AndroidManifest.xml or patching the existing file with FacebookSNS support.


· >>> For iOS platform, click on the menu item of Unity top menu bar: NeatPlug -> FacebookSNS -> Patch iOS Configuration. This is for automatically adding iOS SDK frameworks, libraries or patching the Info.plist file (if needed) as long as the Xcode project is generated by Unity.

[3] Find FacebookSNSAgent Prefab and FacebookSNSListener Prefab in Assets/Plugins/NeatPlug/SNS/FacebookSNS/Prefabs/, open the first scene of your game, drag & drop those two prefabs into the scene.

· >>> NOTE: If you are targeting on Android, before you test, make sure you have your android debug key hash ready to register on Facebook Dev Site when you creating your App.

To get your android key hash, simply turn on the "Debug Mode" switch on FacebookSNSAgent gameObject, and click on "NeatPlug / Tools / Device Console" from Unity menu, you will see a pop up window named "Device Console". Please monitor the messages printed on that window while you running your App on a device.

The key hash is in the line: "NeatPlug-Facebook-SNS Computed keyHash: [********************]"

Don't forget to recopy the keyhash from here if you change the keystore for your App.

[4] Okay, the integration is done here. Now set up your Facebook SNS by filling in a few properties of the FacebookSNSAgent gameObject which you just dropped in the Hierarchy window. To do this, simply select that gameObject, and look at its properties in the Inspector window, you need to fill in:

   · App Id [Android|IOS] - Your App ID for Android or IOS, this can be obtained from Facebook Developer Site.

   · Need User Email Info - Check this if you need the user's email information, plugin will ask the user for nessesary permissions..

   · Need User Birthday Info - Check this if you need the user's birthday information, plugin will ask the user for nessesary permissions.

   · Need User Location Info - Check this if you need the user's location information, plugin will ask the user for nessesary permissions.

   · Auto Fetch User Friends - Check this if you want the plugin to load user's friends info for you automatically.

   · Auto Fetch User Liked Pages - Check this if you want the plugin to load user's liked pages info for you automatically.

   · Auto Load User Scores - Check this if you want the plugin to load user scores (for building a leaderboard) for you automatically.

   · Score Policy - Select the score policy, The_Higher_The_Better or The_Lower_The_Better, this is considered when posting scores.


[5] After you supply above info that the plugin needs, posting on facebook can be as easy as a single line of codes. You can call below methods to post the user scores, messages or screenshots of your game to facebook.

NOTE: The plugin will automatically retrieve user's information for you once the user logged into facebook, you can make use of that info if you need, the user's information will be sent to you via FacebookSNSListener::OnUserInfoArrived(), for more details, goto [6].

With Auto Load User Scores checked, the scores information about the user and his/her friends will be retrieved as long as user logged into facebook, you can use this information to build a leaderboard for the user. Scores information will be sent to you via FacebookSNSListener::OnScoresDataArrived(), you should post score after the scores info arrived. for more details, goto [6].

 

  Call the following methods to initialize and post on facebook:

   · FacebookSNS.Instance().Init(...) - Only needed if you don't supply "App Id" for FacebookSNSAgent.

   · FacebookSNS.Instance().PostScore(...) - Post a score for the user, will show login box if the user not yet logged into facebook.

   · FacebookSNS.Instance().PostAchievement(...) - Post an achievement for the user, will show login box if the user not yet logged into facebook.

   · FacebookSNS.Instance().PostMessage(...) - Post a message on the user's wall, will show login box if the user not yet logged into facebook.

   · FacebookSNS.Instance().PostScreenShot() - Post a screenshot of your App, will show login box if the user not yet logged into facebook.

   · FacebookSNS.Instance().PostImage(...) - Post an image, will show login box if the user not yet logged into facebook.

   · FacebookSNS.Instance().InviteFriends(...) - Invite the friends to use the App, will show login box when necessary.

   · FacebookSNS.Instance().SendAppRequest(...) - Send App Request to specified recipients with customized data, auto login when necessary.

   · FacebookSNS.Instance().LikePage(...) - Have the user like a page.

   · FacebookSNS.Instance().ShowFriendPicker(...) - Show a friend picker.

   · FacebookSNS.Instance().RequestNewReadPermissions(...) - Request additional read permissions.

   · FacebookSNS.Instance().PostStoryWithFeedDialog(...) - Post a story (message) on a friend's wall, allowing user input on Native Feed Dialog.

  There are other useful public methods that FacebookSNS provides, to use them, simply call FacebookSNS.Instance().methodName().
Show All   
public void Init(string appId, string appSecret, ...)
/**
 * Initialize the environment.
 * 
 * @param appId
 *            string - The AppID got from facebook dev site.
 * 
 * @param appSecret
 *            string - The AppSecret got from facebook dev site.
 *                     Generally you don't need to supply this parameter,
 *                     unless you want the GetAppAccessToken() to work.
 *                     IMPORTANT: Putting AppSecret in client code is risky.                       
 *            
 * @param publish
 *            bool - If need to publish scores, message or screenshots.
 *            
 * @param needUserDoBInfo 
 *            bool - If require user's birthday info.
 *            
 * @param needUserLocationInfo
 *            bool - If require user's location info.
 * 
 * @param autoLoadScores
 *            bool - Automatically load user scores after login.
 * 
 * @param scorePolicyLowerBetter 
 *            bool - If set to true, score is the lower the better,
 *                   otherwise score policty is the higher the better(default), 
 *                   which means that only a higher score will be posted.
 * 	
 */
public void Init(string appId, string appSecret, bool publish, 
                   bool needUserDoBInfo, bool needUserLocationInfo, 
                   bool autoLoadScores, bool scorePolicyLowerBetter)
public void PostScore(int score)
/**
 * Post a score for the user to your App.
 * 
 * Only the higher score will be posted when score policy is set to "The_Higher_The_Better", 
 * or only the lower score will be posted when score policy is set to "The_Lower_The_Better".
 * 
 * NOTE: the scores information is required for the plugin to post new scores, 
 * because it will do some calculations and only post better score to facebook.
 * So, make sure you call PostScore() function after the 
 * FacebookSNSListener::OnScoresDataArrived() event is triggered.
 *
 * @param score
 *          int - The score to be posted.
 * 
 */
public void PostScore(int score)
public void PostAchievement(string achivementUrl)
/**
 * Post an achievement for the user to your App.	 
 *
 * @param achivementUrl
 *          string - The URL of specified achievement page.
 *                   For more information about how to set up an achievement, please refer to
 *                   Facebook dev site: https://developers.facebook.com/docs/howtos/achievements/
 */
public void PostAchievement(string achivementUrl)
public void PostScreenShot(string description = null)
/**
 * Capture and post the screenshot of your App on the user's wall.
 * 
 * NOTE: Screenshot capturing is having issue on Android with Unity3.4.x, 
 * you may want to upgrade to Unity3.5 or Unity4 to get it work. That is a Unity bug.
 * 
 * @param description
 *            string - Description for the screenshot.
 * 	
 * 
 */
public void PostScreenShot(string description = null)
public void PostImage(byte[] imgData, string description = null)
/**
 * Post an image on the user's wall.
 * 
 * @param imgData
 *           byte[] - The byte array of the image data.	
 *
 * @param description
 *           string - The description of the image.
 * 	
 */
public void PostImage(byte[] imgData, string description = null)
public void PostMessage(string message, string link = null, string linkName = null, ... )
/**
 * Post a message on the user's feed, with fully exposed parameters.
 * 
 * This function is useful if you want to share a link with detailed information,
 * generally you can use this to post for promotional purpose.
 * 
 * @param message
 *          string - The message.
 * 
 * @param link
 *          string - The link.
 * 
 * @param linkName
 *          string - The name of the link.
 * 
 * @param pictureURL
 *          string - The url of the picture.
 * 
 * @param description
 *          string - The description.
 */
public void PostMessage(string message, string link = null, string linkName = null, 
                             pictureURL link = null, string description = null)
public void PostScorePassingMessage(string pictureURL, string link, string linkName, ... )
/**
 * Post a score passing message on the user's feed.
 * 
 * @param pictureURL
 *            string - The picture URL of your App icon.
 * 
 * @param link
 *            string - Your App download link.
 * 
 * @param linkName
 *            string - The link name.
 *                     An example link name:
 *                     Come play the game!
 * 
 * @param message
 *            string - The message, can contains variables.
 *                     Variables: $fname - Friend's name, $mname - My name,
 *                                $fscore - Friend's score, $mscore - My score.
 *                     An example message:
 *                     player $mname, beats friend $fname's best score in app xx.
 * 
 * @param description
 *            string - The description, can contains variables.
 *                     Variables: $fname - Friend's name, $mname - My name,
 *                                $fscore - Friend's score, $mscore - My score. 
 *                     An example description:
 *                     $mname : $mscore, $fname : $fscore.
 */
public void PostScorePassingMessage(string pictureURL, string link, string linkName, 
                             string message, string description)
public void PostStoryWithFeedDialog(string friendId, string name, string caption, ... )
/**
 * Post a story with a Feed Dialog.
 * 
 * This call will open a Facebook native Feed Dialog for the user to input / change the content of
 * the story that is about to be posted. The story can be posted on the user's own wall or any friend's
 * wall. Currently this is the only approach to post on friend's timeline since Facebook has rejected
 * directly posting to friend's wall using Graph API without user interaction.
 * 
 * @param friendId
 *         string - The friend ID, (or leave it null to post on your own wall) of which you want the 
 *                  story to be posted on the wall.
 * 
 * @param name
 *         string - The name of the story.
 * 
 * @param caption
 *         string - The caption of the story.
 * 
 * @param description
 *         string - The description of the story.
 * 
 * @param link
 *         string - A link you want to share.
 * 
 * @param pictureURL
 *         string - A URL of a picture, that you want to show in the story.
 * 
 * @param sourceURL
 *         string - A URL of a media file, (mp3, swf, etc...) that you want to show in the story.
 *                  NOTE: If you provide both pictureURL and sourceURL, the pictureURL will be ignored.
 * 
 */
public void PostStoryWithFeedDialog(string friendId, string name, string caption, 
                             string description, string link, string pictureURL, string sourceURL)
public void InviteFriends(List<string> friendIds, string title, string message, bool frictionless)
/**
 * Invite friends to App. 
 * 
 * @param friendIds
 *           List<string> - The list of friend IDs. If null supplied,
 *                          the invitation will be sent to all friends
 *                          of the user.
 * 
 * @param title
 *           string - Titile to show on the invitation request dialog.
 * 
 * @param message
 *           string - Message to show in the invitation request detail.
 * 
 * @param frictionless
 *           bool - True for frictionless enabled, false for not.
 *                  Enabling frictionless mode for a invitation request
 *                  is intended to send the request directly to recipients
 *                  without any user interactions.
 */
public void InviteFriends(List<string> friendIds, string title, string message, bool frictionless)
public void SendAppRequest(List<string> recipientIds, string title, string message, bool frictionless)
/**
 * Send an App request to specified recipients.
 *
 * 
 * 
 * @param recipientIds
 *           List<string> - The list of recipient IDs.
 *                          Leave this param null to send app request to all
 *                          friends of the user.
 * 
 * @param title
 *           string - Titile to show on the app request dialog.
 * 
 * @param message
 *           string - Message to show in the app request detail.
 * 
 * @param data
 *           Dictionary - Key-value pairs for the extra params
 *                        attached to the request. This can be used 
 *                        to carry the contextual data of your game.
 *                        e.g. a challenge score.
 * 
 * @param frictionless
 *           bool - True for frictionless enabled, false for not.
 *                  Enabling frictionless mode for an app request
 *                  is intended to send the request directly to recipients
 *                  without any user interactions.
 */
public void SendAppRequest(List<string> recipientIds, string title, string message, bool frictionless)
public void DetectSSOLoginStatus()
/**
 * Detect the SSO Login status.
 *
 * 	
 * 
 * This is very useful to get the user's login status from Facebook App or the browser.
 * Getting the "external" login status is important since there might be session permission
 * change or user's password change outside that invalidated the current cached session.
 * your App may want to know this external login status to render a "Connect to Facbook"
 * button in case the user's connection to facebook is broken, instead of calling Login() 
 * that will bring up a login UI at the point.
 * 
 * The status result will be sent to your App via FacebookSNSListener::OnSSOLoginStatusArrived().
 *
 */
public void DetectSSOLoginStatus()
public void Login()
/**
 * Login the user.	
 *
 * 	 
 * 
 * This will show up a facebook login box if there's no cached SSO facebook session, or
 * simply load the session from cache without user interaction.
 * 
 * You may need to call this function if you want the user to login whenever you want, 
 * instead of logging in at the time when posting a score, message or screenshot.
 * 
 * A usecase is that you let the user login every time your game starts (If the user has
 * not yet logged in yet, neither through your App nor facebook's official App).
 * 
 */
public void Login()
public void Logout()
/**
 * Log out the user.
 */
public void Logout()
public void GetUserProfilePicture(string userId, int width, int height)
/**
 * Get the profile picture of the specififed user.
 * 
 * This function requires a userId, can be either the user's ID or his / her friend's ID.
 * You will need to call this function in OnUserInfoArrived() to get current user's
 * profile picture, or call it in OnUserFriendsArrived() to get some friend's profile
 * picture, because the userId can be obtained there.
 * 
 * The picture url will be sent to you via FacebookSNSListener::OnUserProfilePictureArrived().
 * 
 * @param userId
 *          string - The ID of the user.
 * 
 * @param width
 *          int - The width of the picture (in pixels).
 *                NOTE: facebook will return the closest valid size picture.
 * 
 * @param height
 *          int - The height of the picture (in pixels).
 *                NOTE: facebook will return the closest valid size picture.
 */
public void GetUserProfilePicture(string userId, int width, int height)
public void GetUserFriends()
/**
 * Get the user's friends info.
 * 
 * The friends info will be sent to your App via FacebookSNSListener::OnUserFriendsArrived().
 * 
 * Generally you don't have to call this method explicitly if you have
 * "Auto Fetch User Friends" set to true on FacebookSNSAgent gameObject.
 * If you really need to call this manually, make sure this function gets 
 * called after FacebookSNSListener::OnUserLoggedIn() event triggered, 
 * since a valid session will be needed to make this call.	 
 */
public void GetUserFriends()
public void GetUserLikedPages()
/**
 * Get the user's liked pages.
 * 
 * The pages info will be sent to your App via FacebookSNSListener::OnUserLikedPagesArrived().
 * 
 * Generally you don't have to call this method explicitly if you have
 * "Auto Fetch User Liked Pages" set to true on FacebookSNSAgent gameObject.
 * If you really need to call this manually, make sure this function gets 
 * called after FacebookSNSListener::OnUserLoggedIn() event triggered, 
 * since a valid session will be needed to make this call.	
 */
public void GetUserLikedPages()
public void GetScores()
/**
 * Get the scores information about the user and his/her friends who
 * have played your game.
 * 
 * Scores information would be useful if you want to build a leaderboard
 * among the user and his/her friends.
 * 
 * Generally you don't have to call this method explicitly if you have
 * "Auto Load User Scores" set to true on FacebookSNSAgent gameObject.
 * If you really need to call this manually, e.g. for refreshing the 
 * leaderboard, make sure this function gets called after 
 * FacebookSNSListener::OnUserInfoArrived() event triggered, 
 * since some user information will be needed to make this call.	 
 */	
public void GetScores()
public void RequestGraph(string requestId, string httpMethod, string graphPath, Dictionary graphParams)
/**
 * Make a graph request.
 * 
 * @param requestId
 *            string - The ID for identifying a request.(Arbitrary unique string)
 *                     The requestId will be passed back to your App via event
 *                     FacebookSNSListener::OnRequestGraphResultArrived().
 * 
 * @param httpMethod
 *            string - HTTP method of the request.
 * 
 * @param graphPath
 *            string - The graph path to be requested.
 * 
 * @param graphParams
 *            Dictionary - The parameteres attached for the request.
 * 
 */
public void RequestGraph(string requestId, string httpMethod, string graphPath, Dictionary graphParams)
public void LikePage(string pageId)
/**
 * Have the user like a page.
 * 
 * You App will get notified once the page is successfully liked by the user, via 
 * FacebookSNSListener::OnPageLiked() event.
 * 
 * @param pageId
 *          string - The page ID to be liked.
 */
public void LikePage(string pageId)
public void ShowFriendPicker(bool multiSelect, int maxSelected, FacebookFriendFilter filter)
/**
 * Show a friend picker dialog.
 * 
 * The result will be sent to your App via FacebookSNSListener::OnFriendPickerDismissed().
 * 
 * @param multiSelect
 *           bool - True for multiSelect, false for singleSelect.
 * 
 * @param maxSelected
 *           int - The max number of friends that can be selected in the picker. (0 for no limit)
 * 
 * @param filter
 *           FacebookFriendFilter - The filter for showing filtered friends in the picker.
 */
public void ShowFriendPicker(bool multiSelect, int maxSelected, FacebookFriendFilter filter)
public void RequestNewReadPermissions(string[] permissions)
/**
 * Request new read permissions.
 *
 * Your App will get notified via FacebookSNSListener::OnNewReadPermissionsGranted() if 
 * the permissions are successfully granted, or 
 * FacebookSNSListener::OnFailedToRequestNewReadPermissions when failed to grant permissions.
 * 
 * @param permissions
 *           string[] - The permissions to be requested.
 */
public void RequestNewReadPermissions(string[] permissions)
public void TagFriendInImage(string photoId, string userId, int x, int y)
/**
 * Tag a friend in an image.
 * 
 * To tag a friend in the image, first you need to post an image to facebook by calling
 * PostImage(), and then get the returned facebook photoID in 
 * FacebookSNSListener::OnImagePosted().
 * 
 * @param photoId
 *          String - The photoId from Facebook.	                 
 *          
 * @param userId
 *          String - The friend's userId to be tagged.
 *          
 * @param x
 *         int - Percentage from the left edge of the image.
 *  
 * @param y
 *         int - Percentage from the top edge of the image.
 *    
 */
public void TagFriendInImage(string photoId, string userId, int x, int y)
public void PostMessageWithShareDialog()
/**
 * Post a message with the Share Dialog.
 * 
 * NOTE: This feature is available on iOS only.
 */
public void PostMessageWithShareDialog()
public void ShareLinkWithShareDialog(string link)
/**
 * Share a link with the Share Dialog.
 * 
 * NOTE: This feature is available on iOS only.
 * 
 * @param link
 *         string - The link to be shared.
 */
public void ShareLinkWithShareDialog(string link)
public void PostActionWithShareDialog(string actionType, string propertyName, ... )
/**
 * Post an action with the Share Dialog.
 * 
 * NOTE: This feature is available on iOS only.
 * 
 * @param actionType
 *            string - The action type.
 * 
 * @param propertyName
 *            string - The action property name.
 * 
 * @param propertyValue
 *            string - The action property value.
 * 
 * @param imgBytes
 *            byte[] - The image data.
 */
public void PostActionWithShareDialog(string actionType, string propertyName, 
                                      string propertyValue, byte[] imgBytes)
public void GetAchievements()
/**
 * Get the achievements data for the user.
 */
public void GetAchievements()
public void CheckIfPageLiked(string pageId)
/**
 * Check if a page is liked by the user.
 * 
 * The result will be returned via FacebookSNSListener::OnCheckPageLikedResultArrived().
 * 
 * @param pageId
 *           string - The ID of the page.
 */
public void CheckIfPageLiked(string pageId)
public List<FacebookUserInfo> QueryFriends(string selection)
/**
 * Query friends with conditions for selection (SQL Syntax).
 * 
 * The supported fields of the friend records are listed below:
 * id, username, first_name, middle_name, last_name, name, gender, locale, birthday, 
 * link, country, state, city, email, installed, picture, score.
 * 
 * Please note that some fields may be empty because of the protection of friends' 
 * sensitive information.
 * 
 * @param selection
 *             string - The "WHERE" subclause (without "WHERE") of a SQL query. For example:
 *                   "gender = 'male' and installed = 1" 
 *                   (This filters all male friends who have installed your App)
 * 
 * @return List<FacebookUserInfo> - The query result, a list of friends.
 */  
public List<FacebookUserInfo> QueryFriends(string selection)
public  List<List<FacebookUserInfo>> QueryLeaderboardData(bool includeInactiveFriends, ... )
/**
 * Query the data that is needed for building a leaderboard.
 * 
 * @param includeInactiveFriends
 *             bool - True for including inactive friends, false for excluding them.
 *                    (Inactive friends are those have been removed from the user's friend list)
 * 
 * @param limit
 *             int - The maximum number of total rows to be retrieved. If it is set to 0, stands for 
 *                   no limit.
 * 
 * @param pageRows
 *             int - The maximum number of rows in a single page, 0 stands for no limit.
 * 
 * @return List<List<FacebookUserInfo>> - A list of pages of friends that have been sorted by the 
 *                                        score order specified by "Score Policy" property of the 
 *                                        FacebookSNSAgent gameObject.
 * 
 * The supported fields of the returned friends are listed below:
 * id, username, first_name, middle_name, last_name, name, gender, locale, birthday, 
 * link, country, state, city, email, installed, picture, score.	            
 */
public  List<List<FacebookUserInfo>> QueryLeaderboardData(bool includeInactiveFriends, 
                                                          int limit, int pageRows)
public void ShowLeaderboard(int limit, string title)
/**
 * Show the leaderboard.
 * 
 * This is a convenient way to display a leaderboard. 
 * You don't need to handle any leaderboard related events, just
 * a single call will show the built-in native-style leaderboard
 * to the user.
 * 
 * @param limit
 *           int - The max number of rows in the leaderboard.
 *                 (0 for no limit).
 * 
 * @param title
 *           string - The title of the leaderboard. If pass a null
 *                    or empty string, a default value "Leaderboard"
 *                    will be used.
 */
public void ShowLeaderboard(int limit, string title)
public  List<string> GetPermissions()
/**
 * Get the granted permissions in current session.
 * 
 * @return List<string> - A list of permissions that have been granted in current session.
 */
public  List<string> GetPermissions()

[6] For advanced users who need to handle Facebook events, Read this:

  Follow the instructions to handle Facebook events:

  · Select the dropped FacebookSNSListener gameObject, locate the FacebookSNSListener.cs script, open it and make some modifications.

  These callbacks are exposed in the script, you can supply your own implementations in them.
Show All   
void OnUserLoggedIn() { ... }
/**
 * Fired when the user successfully logged in.
 */
void OnUserLoggedIn()
{
    /// Your code here...   
}
void OnUserFailedToLogIn() { ... }
/**
 * Fired when the user failed to login.
 * 
 * @param err
 *          string - The error string
 */
void OnUserFailedToLogIn(string err)
{
    /// Your code here...   
}
void OnUserLoggedOut() { ... }
/**
 * Fired when the user is logged out.
 */
void OnUserLoggedOut()
{
    /// Your code here...   
}
void OnScorePosted() { ... }
/**
 * Fired when a score is successfully posted.
 */
void OnScorePosted()
{
    /// Your code here...   
}
void OnFailedToPostScore(string err) { ... }
/**
 * Fired when failed to post a score.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostScore(string err)
{
    /// Your code here...
}
void OnAchievementPosted() { ... }
/**
 * Fired when an achievement is successfully posted.
 */
void OnAchievementPosted()
{
    /// Your code here...   
}
void OnFailedToPostAchievement(string err) { ... }
/**
 * Fired when failed to post an achievement.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostAchievement(string err)
{
    /// Your code here...
}
void OnScreenShotPosted() { ... }
/**
 * Fired when a screenshot is successfully posted.
 */
void OnScreenShotPosted()
{
    /// Your code here...   
}
void OnFailedToPostScreenShot(string err) { ... }
/**
 * Fired when failed to capture and post a screenshot.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostScreenShot(string err)
{
    /// Your code here...
}
void OnImagePosted() { ... }
/**
 * Fired when an image is successfully posted.
 */
void OnImagePosted()
{
    /// Your code here...   
}
void OnFailedToPostImage(string err) { ... }
/**
 * Fired when failed to post an image.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostImage(string err)
{
    /// Your code here...
}
void OnMessagePosted() { ... }
/**
 * Fired when a message is successfully posted.
 */
void OnMessagePosted()
{
    /// Your code here...
}
void OnFailedToPostMessage(string err) { ... }
/**
 * Fired when failed to post a message.
 * 
 * @param err
 *          string - The error string
 */
void OnFailedToPostMessage(string err)
{
    /// Your code here...
}
void OnScorePassingMessagePosted() { ... }
/**
 * Fired when a score passing message is successfully posted on friend's news feed.
 */
void OnScorePassingMessagePosted()
{
    /// Your code here...
}
void OnFailedToPostScorePassingMessage(string err) { ... }
/**
 * Fired when failed to post a score passing message.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostScorePassingMessage(string err)
{
    /// Your code here...
}
void OnStoryPostedWithFeedDialog(string storyId) { ... }
/**
 * Fired when a story is successfully posted via a feed dialog.
 */
void OnStoryPostedWithFeedDialog(string storyId)
{
    /// Your code here...
}
void OnFailedToPostStoryWithFeedDialog(string err) { ... }
/**
 * Fired when failed to post a story via a feed dialog.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToPostStoryWithFeedDialog(string err)
{
    /// Your code here...
}
void OnScoresDataArrived(List<FacebookScoreInfo> scores) { ... }
/**
 * Fired when the scores information arrived.
 * 
 * NOTE: the scores information is required for the plugin to post new scores, 
 * because it will do some calculations and only post better score to facebook.
 * So, make sure you call PostScore() function after this event is triggered.
 * 
 * @param scores
 *          List - A list of score info.
 */
void OnScoresDataArrived(List<FacebookScoreInfo> scores)
{
    /// Your code here...
}
void OnFailedToGetScoresData(string err) { ... }
/**
 * Fired when failed to get scores data. 
 * 
 * @param err
 *          string - The error string
 */
void OnFailedToGetScoresData(string err)
{
    /// Your code here...
}
void OnUserInfoArrived(FacebookUserInfo userInfo) { ... }
/**
 * Fired when the user info data arrived.
 * 
 * NOTE: The user's privacy info, birthday and location will be empty if you don't 
 * check "Need User Birthday Info" and "Need User Location Info" on FacebookSNSAgent
 * gameObject. 
 * 
 * @param userInfo
 *         FacebookUserInfo - An object containing the user info. 
 */
void OnUserInfoArrived(FacebookUserInfo userInfo)
{
    /// Your code here...
}
void OnFailedToGetUserInfo(string err) { ... }
/**
 * Fired when failed to get user info.
 *
 * @param err
 *          string - The error string
 */
void OnFailedToGetUserInfo(string err)
{
    /// Your code here...
}
void OnUserProfilePictureArrived(string userId, string pictureUrl) { ... }
/**
 * Fired when a user profile picture arrived.
 * 
 * @param userId
 *          string - The userId specified when call GetUserProfilePicture().
 * 
 * @param pictureUrl
 *          string - The url of the picture.
 */
void OnUserProfilePictureArrived(string userId, string pictureUrl)
{
    /// Your code here...
}
void OnFailedToGetUserProfilePicture(string userId, string err) { ... }
/**
 * Fired when a user profile picture request failed.
 * 
 * @param userId
 *          string - The userId specified when call GetUserProfilePicture().
 * 
 * @param err
 *          string - The error message.
 */
void OnFailedToGetUserProfilePicture(string userId, string err)
{
    /// Your code here...
}
void OnRequestGraphResultArrived(string requestId, string result) { ... }
/**
 * Fired when the result of a graph request comes back.
 * 
 * @param requestId
 *           string - The ID identifying a request.                   
 * 
 * @param result
 *           string - The result in a Json string.
 */
void OnRequestGraphResultArrived(string requestId, string result)
{
    /// Your code here...
}
void OnFailedToRequestGraph(string requestId, string err) { ... }
/**
 * Fired when a graph request failed.
 * 
 * @param requestId
 *           string - The ID identifying a request.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToRequestGraph(string requestId, string err)
{
    /// Your code here...
}
void OnFriendsInvited() { ... }
/**
 * Fired when a friends invitatioin request successfully sent. 
 */
void OnFriendsInvited()
{
    /// Your code here...
}
void OnFailedToInviteFriends(string err) { ... }
/**
 * Fired when a friends invitation request failed.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToInviteFriends(string err)
{
    /// Your code here...
}
void OnAppRequestSent() { ... }
/**
 * Fired when an app request to recipients is successfully sent. 
 */
void OnAppRequestSent()
{
    /// Your code here...
}
void OnFailedToSendAppRequest(string err) { ... }
/**
 * Fired when an app request to recipients failed.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToSendAppRequest(string err)
{
    /// Your code here...
}
void OnAppRequestReceived(FacebookAppRequest request) { ... }
/**
 * Fired when an app request (sent by another user) is received.
 * 
 * An app request is received automatically after the recipient taps on the
 * "Notifications" -> "Request" in Facebook App.
 * 
 * NOTE: A request will be automatcially "consumed" (Deleted) by the plugin,
 * once this event gets called.
 * 
 * @param request
 *           FacebookAppRequest - An object containing all the request info. 
 */
void OnAppRequestReceived(FacebookAppRequest request)
{
    /// Your code here...
}
void OnFailedToReceiveAppRequest(string err) { ... }
/**
 * Fired when failed to receive an app request.
 * 
 * A typical failure is the "The request was already consumed". That happens
 * when the recipient has tapped on that request, but the request is still 
 * visible in Facebook App for some time. (State sync delay). This kind of 
 * error could be ignored.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToReceiveAppRequest(string err)
{
    /// Your code here...
}
void OnUserProfilePictureArrived(string userId, string pictureUrl) { ... }
/**
 * Fired when a user profile picture arrived.
 * 
 * @param userId
 *          string - The userId specified when call GetUserProfilePicture().
 * 
 * @param pictureUrl
 *          string - The url of the picture.
 */
void OnUserProfilePictureArrived(string userId, string pictureUrl)
{
    /// Your code here...
}
void OnFailedToGetUserProfilePicture(string userId, string err) { ... }
/**
 * Fired when a user profile picture request failed.
 * 
 * @param userId
 *          string - The userId specified when call GetUserProfilePicture().
 * 
 * @param err
 *          string - The error message.
 */
void OnFailedToGetUserProfilePicture(string userId, string err)
{
    /// Your code here...
}
void OnSSOLoginStatusArrived(bool loggedIn, int errorCode, int subErrorCode, string errorMessage) { ... }
/**
 * Fired when the SSO login status query result returned..
 * 
 * @param loggedIn
 *          bool - True for logged in, false for not.
 * 
 * @param errorCode
 *          int - Facebook error code.
 * 
 * @param subErrorCode
 *          int - Facebook sub error code.
 * 
 * @param errorMessage
 *          string - Error message. 
 * 
 */
void OnSSOLoginStatusArrived(bool loggedIn, int errorCode, int subErrorCode, string errorMessage)
{
    /// Your code here...
}
void OnPageLiked(string pageId) { ... }
/**
 * Fired when a page is successfully liked by the user.
 */
void OnPageLiked(string pageId)
{
    /// Your code here...
}
void OnUserLikedPagesArrived(List<string> likedPages) { ... }
/**
 * Fired when the user's liked pages query result returned.
 *
 * @param likedPages
 *            List<string> - The page IDs liked by the user.
 */
void OnUserLikedPagesArrived(List<string> likedPages)
{
    /// Your code here...
}
void OnFailedToGetUserLikedPages(string err) { ... }
/**
 * Fired when failed to get the user's liked pages.
 * 
 * @param err
 *         string - The error string.
 */
void OnFailedToGetUserLikedPages(string err)
{
    /// Your code here...
}
void OnFriendPickerDismissed(List<string> selectedFriends) { ... }
/**
 * Fired when the friend picker dismissed.
 * 
 * @param selectedFriends
 *          List<string> - The selected friends.
 */
void OnFriendPickerDismissed(List<string> selectedFriends)
{
    /// Your code here...
}
void OnNewReadPermissionsGranted(List<string> permissions) { ... }
/** 
 * Fired when the new read permissions are successfully granted.
 * 
 * @param permissions
 *            List<string> - The newly granted permissions.
 */
void OnNewReadPermissionsGranted(List<string> permissions)
{
    /// Your code here...
}
void OnFailedToRequestNewReadPermissions(List<string> permissions, string err) { ... }
/**
 * Fired when failed to request new read permissions.
 * 
 * @param permissions
 *            List<string> - The newly requested permissions.
 * 
 * @param err
 *         string - The error message.
 */
void OnFailedToRequestNewReadPermissions(List<string> permissions, string err)
{
    /// Your code here...
}
void OnMessagePostedWithShareDialog() { ... }
/**
 * Fired when a message is successfully posted via Share Dialog.
 */	
void OnMessagePostedWithShareDialog()
{
    /// Your code here...   
}
void OnFailedToPostMessageWithShareDialog() { ... }
/**
 * Fired when failed to post a message via Share Dialog.
 * 
 * @param err
 *         string - The error message.
 */
void OnFailedToPostMessageWithShareDialog(string err)
{
    /// Your code here...   
}
void OnLinkSharedWithShareDialog() { ... }
/**
 * Fired when a link is successfully shared via Share Dialog.
 * 
 * @param link
 *         string - The link that is shared.
 */
void OnLinkSharedWithShareDialog(string link)
{
    /// Your code here...   
}
void OnFailedToShareLinkWithShareDialog() { ... }
/**
 * Fired when failed to share a link via Share Dialog.
 * 
 * @param link
 *         string - The link that is attempted.
 * 
 * @param err
 *         string - The error message.
 */
void OnFailedToShareLinkWithShareDialog(string link, string err)
{
    /// Your code here...   
}
void OnActionPostedWithShareDialog() { ... }
/**
 * Fired when an Open Graph Action is successfully posted.
 * 
 * @param actionTYpe 
 *          string - The Action Type.
 * 
 * @param propertyName
 *          string - The property name.
 */
void OnActionPostedWithShareDialog(string actionType, string propertyName)
{
    /// Your code here...   
}
void OnFailedToPostActionWithShareDialog() { ... }
/**
 * Fired when failed to post an Open Graph Action.
 * 
 * @param actionTYpe 
 *          string - The Action Type.
 * 
 * @param propertyName
 *          string - The property name.
 * 
 * @param err
 *          string - The error string.
 */
void OnFailedToPostActionWithShareDialog(string actionType, string propertyName, string err)
{
    /// Your code here...   
}
void OnAchievementsDataArrived() { ... }
/**
 * Fired when the achievements information arrived.		 
 * 
 * @param achievements
 *          List<FacebookAchievementInfo> - A list of achievement info.
 */
void OnAchievementsDataArrived(List achievements)
{
    /// Your code here...   
}
void OnFailedToGetAchievementsData() { ... }
/**
 * Fired when failed to get achievements data.
 * 
 * @param err
 *         string - The error message.
 */
void OnFailedToGetAchievementsData(string err)
{
    /// Your code here...   
}
void OnCheckPageLikedResultArrived() { ... }
/**
 * Fired when the result of checking if page is liked by the user returned.
 * 
 * @param pageId
 *         string - The page ID that was checked for.
 * 
 * @param liked
 *         bool - True for liked, false for not liked.
 */
void OnCheckPageLikedResultArrived(string pageId, bool liked)
{
    /// Your code here...   
}
void OnFailedToCheckPageLiked() { ... }
/**
 * Fired when failed to check if page is liked by the user.
 * 
 * @param pageId
 *         string - The page ID that was checked for.
 * 
 * @param err
 *         string - The error message.
 */
void OnFailedToCheckPageLiked(string pageId, string err)
{
    /// Your code here...   
}

[7] Build your App now. To compile for iOS platform, you need to have Xcode 4.5 (with iOS SDK v6) or above installed.

[8] Test and verify if the Facebook functions work as expected, it would be helpful for you to address issues if you take a look at the logcat output (Android) or xcode debug console (iOS) to find the debug / error / warning messages.

IMPORTANT: Don't forget to register your publish key hash on Facebook and verify if the functions work with your release package.

[EOF] Should you have any questions or encounter any problems while integrating the plugin, please do not hesitate to shoot us an email at support@neatplug.com, we will be more than happy to help you. Thanks for choosing NeatPlug solutions!