Show / Hide Table of Contents

Class Fb

Inheritance
System.Object
Fb
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Facebook
Assembly: cs.temp.dll.dll
Syntax
public static class Fb

Properties

AccessToken

Saved user AccessToken from last login result Can be null if there wa no success during current session

Declaration
public static AccessToken AccessToken { get; }
Property Value
Type Description
AccessToken

AccessTokenString

Saved user AccessToken string from last login result System.String.Empty if there wa no success during current session

Declaration
public static string AccessTokenString { get; }
Property Value
Type Description
System.String

ClientToken

Gets the app client token. ClientToken might be different from FBSettings.ClientToken if using the programmatic version of SA_FB.Init().

Declaration
public static string ClientToken { get; }
Property Value
Type Description
System.String

FbGraphApi

Object that contain methods to communicate with facebook graph API.

Declaration
public static FbGraphAPI FbGraphApi { get; }
Property Value
Type Description
FbGraphAPI

IsInitialized

Check whether the Unity SDK has been initialized. false if the SDK has not been initialized.

Declaration
public static bool IsInitialized { get; }
Property Value
Type Description
System.Boolean

IsLoggedIn

Check whether a user is currently logged in and has authorized your app

Declaration
public static bool IsLoggedIn { get; }
Property Value
Type Description
System.Boolean

Methods

ActivateApp()

By logging app activation events, you can observe how frequently users activate your app, how much time they spend using it, and view other demographic information through Facebook Analytics for Apps.

Declaration
public static void ActivateApp()

API(String, HttpMethod, FacebookDelegate<IGraphResult>, IDictionary<String, String>)

Declaration
public static void API(string query, HttpMethod method, FacebookDelegate<IGraphResult> callback = null, IDictionary<string, string> formData = null)
Parameters
Type Name Description
System.String query
HttpMethod method
FacebookDelegate<IGraphResult> callback
IDictionary<System.String, System.String> formData

GetFriends(Int32, Action<FbGraphFriendsListResult>, FbCursor)

This edge allows you to: get the User's friends who have installed the app making the query get the User's total number of friends (including those who have not installed the app making the query)

Requires "user_friends" permission https://developers.facebook.com/docs/graph-api/reference/user/friends for information

Declaration
public static void GetFriends(int limit, Action<FbGraphFriendsListResult> callback, FbCursor cursor)
Parameters
Type Name Description
System.Int32 limit

Result limit

Action<FbGraphFriendsListResult> callback

Request callback

FbCursor cursor

GetLoggedInUserInfo(Action<FbGetUserResult>)

Retries current logged user info. See FbUser for more details.

Declaration
public static void GetLoggedInUserInfo(Action<FbGetUserResult> callback)
Parameters
Type Name Description
Action<FbGetUserResult> callback

Init(InitDelegate, HideUnityDelegate, String)

Sets the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors. This function can only be called once during the lifetime of the object; later calls lead to undefined behavior. Relies on properties that are set in the Unity Editor using the Facebook | Edit settings menu option,

Also ActivateApp() method will be called automatically when initialization is completed

Declaration
public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null, string authResponse = null)
Parameters
Type Name Description
InitDelegate onInitComplete

A function that will be called once all data structures in the SDK are initialized; any code that should synchronize with the player's Facebook session should be in onInitComplete().

HideUnityDelegate onHideUnity

A function that will be called when Facebook tries to display HTML content within the boundaries of the Canvas. When called with its sole argument set to false, your game should pause and prepare to lose focus. If it's called with its argument set to true, your game should prepare to regain focus and resume play. Your game should check whether it is in fullscreen mode when it resumes, and offer the player a chance to go to fullscreen mode if appropriate.

System.String authResponse

effective in Web Player only, rarely used A Facebook auth_response you have cached to preserve a session, represented in JSON. If an auth_response is provided, FB will initialize itself using the data from that session, with no additional checks.

Init(String, String, Boolean, Boolean, Boolean, Boolean, Boolean, String, String, HideUnityDelegate, InitDelegate)

Sets the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors. This function can only be called once during the lifetime of the object; later calls lead to undefined behavior.

Also ActivateApp() method will be called automatically when initialization is completed

Declaration
public static void Init(string appId, string clientToken = null, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, string javascriptSDKLocale = "en_US", HideUnityDelegate onHideUnity = null, InitDelegate onInitComplete = null)
Parameters
Type Name Description
System.String appId

The Facebook application ID of the initializing app.

System.String clientToken

Client Token

System.Boolean cookie

Sets a cookie which your server-side code can use to validate a user's Facebook session

System.Boolean logging

If true, outputs a verbose log to the Javascript console to facilitate debugging. Effective on Web only.

System.Boolean status

If true, attempts to initialize the Facebook object with valid session data.*

System.Boolean xfbml

If true, Facebook will immediately parse any XFBML elements on the Facebook Canvas page hosting the app, like the page plugin. Effective on Web only.

System.Boolean frictionlessRequests

Frictionless Requests

System.String authResponse

effective in Web Player only, rarely used A Facebook auth_response you have cached to preserve a session, represented in JSON. If an auth_response is provided, FB will initialize itself using the data from that session, with no additional checks.

System.String javascriptSDKLocale

javascript SDK Locale

HideUnityDelegate onHideUnity

A function that will be called when Facebook tries to display HTML content within the boundaries of the Canvas. When called with its sole argument set to false, your game should pause and prepare to lose focus. If it's called with its argument set to true, your game should prepare to regain focus and resume play. Your game should check whether it is in fullscreen mode when it resumes, and offer the player a chance to go to fullscreen mode if appropriate.

InitDelegate onInitComplete

A function that will be called once all data structures in the SDK are initialized; any code that should synchronize with the player's Facebook session should be in onInitComplete().

LogInWithPublishPermissions(Action<FbLoginResult>)

Prompts the user to authorize your application for publish permissions using the Login Dialog appropriate to the platform. If the user is already logged in and has authorized your application, checks whether all permissions in the permissions parameter have been granted, and if not, prompts the user for any that are newly requested.

People are sensitive about granting publish permissions, so you should only ask for publish permissions once a person is ready to post something from your app and not during the initial login.

In the Unity Editor, a stub function is called, which will prompt you to provide an access token from the Access Token Tool. Please note that this token will not necessarily contain the permissions you specified in FB.Login. To change this token's permissions, please use the Graph API Explorer.

Declaration
public static void LogInWithPublishPermissions(Action<FbLoginResult> callback)
Parameters
Type Name Description
Action<FbLoginResult> callback

A delegate that will be called with the result of the Login Dialog.

LogInWithPublishPermissions(IEnumerable<String>, Action<FbLoginResult>)

Prompts the user to authorize your application for publish permissions using the Login Dialog appropriate to the platform. If the user is already logged in and has authorized your application, checks whether all permissions in the permissions parameter have been granted, and if not, prompts the user for any that are newly requested.

People are sensitive about granting publish permissions, so you should only ask for publish permissions once a person is ready to post something from your app and not during the initial login.

In the Unity Editor, a stub function is called, which will prompt you to provide an access token from the Access Token Tool. Please note that this token will not necessarily contain the permissions you specified in FB.Login. To change this token's permissions, please use the Graph API Explorer.

Declaration
public static void LogInWithPublishPermissions(IEnumerable<string> permissions, Action<FbLoginResult> callback)
Parameters
Type Name Description
IEnumerable<System.String> permissions

A list of Facebook permissions requested from the user

Action<FbLoginResult> callback

A delegate that will be called with the result of the Login Dialog.

LogInWithReadPermissions(Action<FbLoginResult>)

Prompts the user to authorize your application using the Login Dialog appropriate to the platform. If the user is already logged in and has authorized your application, checks whether all permissions in the permissions parameter have been granted, and if not, prompts the user for any that are newly requested.

In the Unity Editor, a stub function is called, which will prompt you to provide an access token from the Access Token Tool. Please note that this token will not necessarily contain the permissions you specified in FB.Login. To change this token's permissions, please use the Graph API Explorer.

Declaration
public static void LogInWithReadPermissions(Action<FbLoginResult> callback)
Parameters
Type Name Description
Action<FbLoginResult> callback

A delegate that will be called with the result of the Login Dialog.

LogInWithReadPermissions(IEnumerable<String>, Action<FbLoginResult>)

Prompts the user to authorize your application using the Login Dialog appropriate to the platform. If the user is already logged in and has authorized your application, checks whether all permissions in the permissions parameter have been granted, and if not, prompts the user for any that are newly requested.

In the Unity Editor, a stub function is called, which will prompt you to provide an access token from the Access Token Tool. Please note that this token will not necessarily contain the permissions you specified in FB.Login. To change this token's permissions, please use the Graph API Explorer.

Declaration
public static void LogInWithReadPermissions(IEnumerable<string> permissions, Action<FbLoginResult> callback)
Parameters
Type Name Description
IEnumerable<System.String> permissions

A list of Facebook permissions requested from the user

Action<FbLoginResult> callback

A delegate that will be called with the result of the Login Dialog.

LogOut()

On Web, this method will log the user out of both your site and Facebook. On iOS and Android, it will log the user out of your Application. On all the platforms it will also invalidate any access token that you have for the user that was issued before the logout.

On Web, you almost certainly should not use this function, which is provided primarily for completeness. Having a logout control inside a game that executes a Facebook-wide logout will violate users' expectations. Instead, allow users to control their logged-in status on Facebook itself.

Declaration
public static void LogOut()
In This Article
Back to top Generated by DocFX