Packagecom.distriqt.extension.facebookapi
Classpublic final class FacebookAPI
InheritanceFacebookAPI Inheritance flash.events.EventDispatcher

This class represents the FacebookAPI extension.



Public Properties
 PropertyDefined By
  accountKit : AccountKit
[read-only] Access to the Account Kit functionality.
FacebookAPI
  appEvents : AppEvents
[read-only] Access to the Analytics functionality.
FacebookAPI
  appInvite : AppInvite
[read-only] Access to the AppInvite functionality to create App Invite Dialogs.
FacebookAPI
  appLinks : AppLinks
[read-only] Access to the AppLinks functionality to listen for and retrieve App Links.
FacebookAPI
  gameRequest : GameRequest
[read-only] Access to the AppInvite functionality to create App Invite Dialogs.
FacebookAPI
  graphAPI : GraphAPI
[read-only] Access to the Graph API functionality.
FacebookAPI
  implementation : String
[read-only] The implementation currently in use.
FacebookAPI
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
FacebookAPI
  messageDialog : MessageDialog
[read-only] Access to the MessageDialog functionality to enable people to post to Facebook Messenger from your application.
FacebookAPI
  nativeVersion : String
[read-only] The native version string of the native extension.
FacebookAPI
  service : FacebookAPI
[static] [read-only] The singleton instance of the FacebookAPI class.
FacebookAPI
  shareAPI : ShareAPI
[read-only] Access to the ShareAPI functionality to enable people to post to Facebook from your application.
FacebookAPI
  shareDialog : ShareDialog
[read-only] Access to the ShareDialog functionality to enable people to post to Facebook from your application.
FacebookAPI
  version : String
[read-only] The version of this extension.
FacebookAPI
Public Methods
 MethodDefined By
  
Constructor You should not call this directly, but instead use the singleton access
FacebookAPI
  
Closes the current Facebook session and logs the user out.
FacebookAPI
  
createSession(permissions:Array, readOnly:Boolean = false, loginBehaviour:String):Boolean
Creates and authorises a new Facebook session for your user.
FacebookAPI
  
dispose():void
Disposes the extension and releases any allocated resources.
FacebookAPI
  
Retrieves the current session access token, if available
FacebookAPI
  
Retrieves the current user's ID if available
FacebookAPI
  
getSDKVersion():String
Returns the current version of the FacebookSDK used by the extension.
FacebookAPI
  
init(key:String):void
Deprecated: You no longer need to use an application key
[static] Initialises the extension class for use with the provided key.
FacebookAPI
  
initialiseApp(facebookAppId:String, urlSchemeSuffix:String):Boolean
Initialise the Facebook application by providing your Facebook App ID.
FacebookAPI
  
Detects whether the device has the native Facebook app installed
FacebookAPI
  
isSessionOpen():Boolean
Checks if a session is currently open.
FacebookAPI
  
requestPermissions(permissions:Array, readOnly:Boolean = false, loginBehaviour:String):Boolean
Requests new Facebook permissions for the application.
FacebookAPI
  
Detects whether the device has an integrated Facebook account set up in their iOS settings.
FacebookAPI
Public Constants
 ConstantDefined By
  EXT_CONTEXT_ID : String = com.distriqt.FacebookAPI
[static]
FacebookAPI
  VERSION : String = 7.1.212
[static]
FacebookAPI
Property Detail
accountKitproperty
accountKit:AccountKit  [read-only]

Access to the Account Kit functionality.


Implementation
    public function get accountKit():AccountKit
appEventsproperty 
appEvents:AppEvents  [read-only]

Access to the Analytics functionality.


Implementation
    public function get appEvents():AppEvents
appInviteproperty 
appInvite:AppInvite  [read-only]

Access to the AppInvite functionality to create App Invite Dialogs.


Implementation
    public function get appInvite():AppInvite
appLinksproperty 
appLinks:AppLinks  [read-only]

Access to the AppLinks functionality to listen for and retrieve App Links.


Implementation
    public function get appLinks():AppLinks
gameRequestproperty 
gameRequest:GameRequest  [read-only]

Access to the AppInvite functionality to create App Invite Dialogs.


Implementation
    public function get gameRequest():GameRequest
graphAPIproperty 
graphAPI:GraphAPI  [read-only]

Access to the Graph API functionality.


Implementation
    public function get graphAPI():GraphAPI
implementationproperty 
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
messageDialogproperty 
messageDialog:MessageDialog  [read-only]

Access to the MessageDialog functionality to enable people to post to Facebook Messenger from your application.


Implementation
    public function get messageDialog():MessageDialog
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:FacebookAPI  [read-only]

The singleton instance of the FacebookAPI class.


Implementation
    public static function get service():FacebookAPI

Throws
Error — If there was a problem creating or accessing the extension, or if the developer key is invalid
shareAPIproperty 
shareAPI:ShareAPI  [read-only]

Access to the ShareAPI functionality to enable people to post to Facebook from your application.


Implementation
    public function get shareAPI():ShareAPI
shareDialogproperty 
shareDialog:ShareDialog  [read-only]

Access to the ShareDialog functionality to enable people to post to Facebook from your application.


Implementation
    public function get shareDialog():ShareDialog
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
FacebookAPI()Constructor
public function FacebookAPI()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
closeSession()method
public function closeSession():void

Closes the current Facebook session and logs the user out.

createSession()method 
public function createSession(permissions:Array, readOnly:Boolean = false, loginBehaviour:String):Boolean

Creates and authorises a new Facebook session for your user. If the user already has an access token, this may not change the view, but simply return.

If the user is not logged in and has no access token, the login flow will begin.

If the device has the Facebook application installed, the flow will switch to the Facebook app for the login and permissions dialog. If not, this will fall back to using a browser-based web login page.

It's best to request basic access such as "basic_info" when creating a session, and then request publish permissions later when required by your application. This method of permission request is recommended by Facebook.

Parameters

permissions:Array — Array of Facebook permissions to request for the session
 
readOnly:Boolean (default = false) — Whether your app only requires read permissions. Set to true if you are not requesting any publish permissions. (defaults to false)
 
loginBehaviour:String (default = NaN) — Value from the LoginBehaviour constants

Returns
Booleantrue if the process was started successfully and false if there was an error
dispose()method 
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

getAccessToken()method 
public function getAccessToken():AccessToken

Retrieves the current session access token, if available

Returns
AccessToken — The access token
getCurrentUserID()method 
public function getCurrentUserID():String

Retrieves the current user's ID if available

Returns
String — The current logged in user's ID
getSDKVersion()method 
public function getSDKVersion():String

Returns the current version of the FacebookSDK used by the extension.

Returns
String — String the Facebook SDK version
init()method 
public static function init(key:String):void
Deprecated: You no longer need to use an application key

Initialises the extension class for use with the provided key.

Parameters

key:String


Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
initialiseApp()method 
public function initialiseApp(facebookAppId:String, urlSchemeSuffix:String):Boolean

Initialise the Facebook application by providing your Facebook App ID.

Parameters

facebookAppId:String — A Facebook application id
 
urlSchemeSuffix:String — (Optional) The URL Scheme Suffix to be used in scenarios where multiple iOS applications use one Facebook App ID. Must contain only lowercase letters.

Returns
Boolean
isFacebookAppInstalled()method 
public function isFacebookAppInstalled():Boolean

Detects whether the device has the native Facebook app installed

Returns
Boolean — Boolean true or false
isSessionOpen()method 
public function isSessionOpen():Boolean

Checks if a session is currently open.

Returns
Boolean — Boolean True or false if a session is opened
requestPermissions()method 
public function requestPermissions(permissions:Array, readOnly:Boolean = false, loginBehaviour:String):Boolean

Requests new Facebook permissions for the application.

Parameters

permissions:Array — Array of facebook permissions to request
 
readOnly:Boolean (default = false) — Whether the permissions are "read" only. Set to true if you are requesting read permissions. Set to false if you are requesting publish permissions. (defaults to false)
 
loginBehaviour:String (default = NaN) — Value from the LoginBehaviour constants

Returns
Booleantrue if the process was started successfully and false if there was an error
userHasIntegratedFacebookAccount()method 
public function userHasIntegratedFacebookAccount():Boolean

Detects whether the device has an integrated Facebook account set up in their iOS settings.

This is only relevant on iOS and will always return false on Android devices.

Returns
Booleantrue if the device has a Facebook account set up in the settings
Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.FacebookAPI

VERSIONConstant 
public static const VERSION:String = 7.1.212