Package | com.marpies.ane.facebook |
Interface | public interface IAIRFacebook extends flash.events.IEventDispatcher |
Property | Defined By | ||
---|---|---|---|
accessToken : String [read-only]
Returns access token granted for the logged in user or null if no user is logged in. | IAIRFacebook | ||
accessTokenExpirationTimestamp : Number [read-only]
Returns expiration timestamp (in milliseconds) of the current
access token or 0 if there is no access token. | IAIRFacebook | ||
applicationId : String [read-only]
Returns the Facebook app id. | IAIRFacebook | ||
basicUserProfile : BasicUserProfile [read-only]
Returns basic user profile. | IAIRFacebook | ||
deniedPermissions : Vector.<String> [read-only]
Returns a list of permissions which were denied by the user during the login process. | IAIRFacebook | ||
gameRequests : IAIRFacebookGameRequests [read-only]
Returns object that provides Facebook Game Requests API. | IAIRFacebook | ||
grantedPermissions : Vector.<String> [read-only]
Returns a list of granted permissions. | IAIRFacebook | ||
isAccessTokenExpired : Boolean [read-only]
Returns true if the current access token is expired or does not exist,
false otherwise. | IAIRFacebook | ||
isBasicUserProfileReady : Boolean [read-only]
Returns true if the user is logged in and her basic profile is ready to be accessed. | IAIRFacebook | ||
isInitialized : Boolean [read-only]
Returns true if the Facebook SDK has been successfully initialized. | IAIRFacebook | ||
isSupported : Boolean [read-only]
Returns true if the Facebook SDK is supported on current platform. | IAIRFacebook | ||
isUserLoggedIn : Boolean [read-only]
Returns true if user successfully went through Facebook login process or a valid
access token was loaded during initialization, false otherwise. | IAIRFacebook | ||
openGraph : IAIRFacebookOpenGraph [read-only]
Returns object that provides Facebook Open Graph API. | IAIRFacebook | ||
sdkVersion : String [read-only]
Returns version of the native Facebook SDK. | IAIRFacebook | ||
settings : AIRFacebookSettings [read-only]
Returns Facebook and extension settings. | IAIRFacebook | ||
share : IAIRFacebookShare [read-only]
Returns object that provides Facebook sharing API. | IAIRFacebook |
Method | Defined By | ||
---|---|---|---|
addBasicUserProfileListener(listener:IAIRFacebookBasicUserProfileListener):void
Adds object that will be notified when basic user profile is ready. | IAIRFacebook | ||
dispose():void
Disposes native extension context. | IAIRFacebook | ||
fetchDeferredAppLink(listener:IAIRFacebookDeferredAppLinkListener = null):void
Fetches deferred app link data. | IAIRFacebook | ||
init(applicationId:String, cachedAccessTokenListener:IAIRFacebookCachedAccessTokenListener = null, basicUserProfileListener:IAIRFacebookBasicUserProfileListener = null, sdkInitListener:IAIRFacebookSDKInitListener = null):Boolean
Initializes extension context and native Facebook SDK. | IAIRFacebook | ||
isPermissionGranted(permission:String):Boolean
Allows checking if a particular permission is granted. | IAIRFacebook | ||
logEvent(eventName:String, parameters:Object = null, valueToSum:Number = 0.0):void
Logs an application event for Facebook analytics. | IAIRFacebook | ||
loginWithPublishPermissions(permissions:Vector.<String> = null, listener:IAIRFacebookLoginListener = null):void
If user is not logged in then initiates user login with publish permissions
otherwise requests publish permissions which have not been granted yet. | IAIRFacebook | ||
loginWithReadPermissions(permissions:Vector.<String> = null, listener:IAIRFacebookLoginListener = null):void
If user is not logged in then initiates user login with read permissions
otherwise requests read permissions which have not been granted yet. | IAIRFacebook | ||
logout(confirm:Boolean = false, title:String = Log out from Facebook?, message:String = You will not be able to connect with friends!, confirmLabel:String = Log out, cancelLabel:String = Cancel, listener:IAIRFacebookLogoutListener = null):void
Attempts to log out current user and clear cached access token. | IAIRFacebook | ||
Removes object that was added earlier using addBasicUserProfileListener. | IAIRFacebook | ||
requestExtendedUserProfile(fields:Vector.<String> = null, forceRefresh:Boolean = false, listener:IAIRFacebookExtendedUserProfileListener = null):ExtendedUserProfile
Requests extended user profile that may contain additional user properties
depending on the permissions that were granted to your app. | IAIRFacebook | ||
requestUserFriends(fields:Vector.<String> = null, listener:IAIRFacebookUserFriendsListener = null):void
Requests user friends. | IAIRFacebook | ||
requestUserProfilePicture(width:int, height:int, autoLoad:Boolean = false, listener:IAIRFacebookUserProfilePictureListener = null):String
Requests user's profile picture and optionally loads the picture. | IAIRFacebook |
accessToken | property |
accessToken:String
[read-only]
Returns access token granted for the logged in user or null
if no user is logged in.
public function get accessToken():String
accessTokenExpirationTimestamp | property |
accessTokenExpirationTimestamp:Number
[read-only] Returns expiration timestamp (in milliseconds) of the current access token or 0 if there is no access token.
public function get accessTokenExpirationTimestamp():Number
applicationId | property |
applicationId:String
[read-only] Returns the Facebook app id.
public function get applicationId():String
basicUserProfile | property |
basicUserProfile:BasicUserProfile
[read-only]
Returns basic user profile. This property still may return null
when accessed
inside of a login handler. Listen to AIRFacebookBasicUserProfileEvent.PROFILE_READY
or add listener object using AIRFacebook.addBasicUserProfileListener
to be notified
when the user's profile is ready to be accessed.
public function get basicUserProfile():BasicUserProfile
See also
deniedPermissions | property |
deniedPermissions:Vector.<String>
[read-only] Returns a list of permissions which were denied by the user during the login process.
public function get deniedPermissions():Vector.<String>
gameRequests | property |
gameRequests:IAIRFacebookGameRequests
[read-only] Returns object that provides Facebook Game Requests API.
public function get gameRequests():IAIRFacebookGameRequests
grantedPermissions | property |
grantedPermissions:Vector.<String>
[read-only] Returns a list of granted permissions.
public function get grantedPermissions():Vector.<String>
isAccessTokenExpired | property |
isAccessTokenExpired:Boolean
[read-only]
Returns true
if the current access token is expired or does not exist,
false
otherwise.
public function get isAccessTokenExpired():Boolean
isBasicUserProfileReady | property |
isBasicUserProfileReady:Boolean
[read-only]
Returns true
if the user is logged in and her basic profile is ready to be accessed.
This property still may be false
when accessed inside of a login handler. Listen to
AIRFacebookBasicUserProfileEvent.PROFILE_READY
or add listener object using
AIRFacebook.addBasicUserProfileListener
to be notified when the user's profile is ready
to be accessed.
public function get isBasicUserProfileReady():Boolean
See also
isInitialized | property |
isInitialized:Boolean
[read-only]
Returns true
if the Facebook SDK has been successfully initialized.
public function get isInitialized():Boolean
isSupported | property |
isSupported:Boolean
[read-only]
Returns true
if the Facebook SDK is supported on current platform.
public function get isSupported():Boolean
isUserLoggedIn | property |
isUserLoggedIn:Boolean
[read-only]
Returns true
if user successfully went through Facebook login process or a valid
access token was loaded during initialization, false
otherwise. This property
may return false
shortly after a call to AIRFacebook.init()
method even if a cached
access token may exist. To find out if user's token was loaded after initialization listen to
AIRFacebookCachedAccessTokenEvent.RESULT
or specify a listener object when calling
AIRFacebook.init()
method.
Note: user's profile may not be ready to access even when this property returns true
,
especially when trying to access user's profile inside of a login handler.
To find out if you can access user's profile use isBasicUserProfileReady
instead.
public function get isUserLoggedIn():Boolean
openGraph | property |
openGraph:IAIRFacebookOpenGraph
[read-only] Returns object that provides Facebook Open Graph API.
public function get openGraph():IAIRFacebookOpenGraph
sdkVersion | property |
sdkVersion:String
[read-only] Returns version of the native Facebook SDK.
public function get sdkVersion():String
settings | property |
settings:AIRFacebookSettings
[read-only]
Returns Facebook and extension settings.
Changes only take effect when set before calling AIRFacebook.instance.init()
.
public function get settings():AIRFacebookSettings
See also
share | property |
share:IAIRFacebookShare
[read-only] Returns object that provides Facebook sharing API.
public function get share():IAIRFacebookShare
addBasicUserProfileListener | () | method |
public function addBasicUserProfileListener(listener:IAIRFacebookBasicUserProfileListener):void
Adds object that will be notified when basic user profile is ready. This object is retained for as long
as the extension is active or until AIRFacebook.removeBasicUserProfileListener()
is called.
Since the listener added using AIRFacebook.init()
is only called once, this method is useful
for adding a listener again, for example after user logs out.
Parameters
listener:IAIRFacebookBasicUserProfileListener — Object to be notified when basic user profile is ready.
|
dispose | () | method |
public function dispose():void
Disposes native extension context.
fetchDeferredAppLink | () | method |
public function fetchDeferredAppLink(listener:IAIRFacebookDeferredAppLinkListener = null):void
Fetches deferred app link data.
Parameters
listener:IAIRFacebookDeferredAppLinkListener (default = null ) — Object that will be notified about the request result.
|
deferredAppLinkRequestResult: — Dispatched
when the result of the request is obtained.
|
init | () | method |
public function init(applicationId:String, cachedAccessTokenListener:IAIRFacebookCachedAccessTokenListener = null, basicUserProfileListener:IAIRFacebookBasicUserProfileListener = null, sdkInitListener:IAIRFacebookSDKInitListener = null):Boolean
Initializes extension context and native Facebook SDK.
Parameters
applicationId:String — Facebook application id.
| |
cachedAccessTokenListener:IAIRFacebookCachedAccessTokenListener (default = null ) — Object that will be notified whether cached access token was found or not.
| |
basicUserProfileListener:IAIRFacebookBasicUserProfileListener (default = null ) — Object that will be notified when basic user profile is ready. This object will
be notified only once, either shortly after initialization (i.e. if cached access
token was found) or after the first successful login. If user logs out you can add
the listener object again using AIRFacebook.addBasicUserProfileListener .
| |
sdkInitListener:IAIRFacebookSDKInitListener (default = null ) — Object that will be notified when native Facebook SDK is initialized.
|
Boolean — true if the extension context was created, false otherwise.
|
sdkInit: — Dispatched when the Facebook SDK is initialized,
making the rest of the API safe to use. Considering the initialization may take slightly longer on Android
in some rare cases, it is recommended to make this event's handler a starting point in using AIRFacebook's API.
Listener for this event should be added before calling AIRFacebook.init() .
| |
cachedAccessTokenResult: — Dispatched shortly
after initialization with information whether cached access token was found or not.
| |
profileReady: — Dispatched only if a cached
access token is found. Provides basic information about logged in user.
|
See also
isPermissionGranted | () | method |
public function isPermissionGranted(permission:String):Boolean
Allows checking if a particular permission is granted.
Parameters
permission:String — Permission to check for.
|
Boolean — true if permission is granted, false otherwise.
|
logEvent | () | method |
public function logEvent(eventName:String, parameters:Object = null, valueToSum:Number = 0.0):void
Logs an application event for Facebook analytics.
Example logging of a purchase:
const params:Object = {}; params[AIRFacebookAppEvent.EVENT_PARAM_CURRENCY] = "USD"; params[AIRFacebookAppEvent.EVENT_PARAM_CONTENT_TYPE] = "shoes"; params[AIRFacebookAppEvent.EVENT_PARAM_CONTENT_ID] = "HDFU-8452"; AIRFacebook.logEvent( AIRFacebookAppEvent.EVENT_NAME_PURCHASED, params, 23.50 );
Parameters
eventName:String — Event name used to denote the event. Choose amongst the EVENT_NAME
constants in AIRFacebookAppEvent when possible, or create your own.
Event names should be 40 characters or less, alphanumeric, and can include spaces,
underscores or hyphens, but must not have a space or hyphen as the first character.
| |
parameters:Object (default = null ) — Key-value object specifying parameters to log with the event. Insights will allow
looking at the logs of these events via different parameter values. You can log on
the order of 10 parameters with each distinct eventName . It is advisable
to limit the number of unique values provided for each parameter in the thousands.
As an example, do not attempt to provide a unique parameter value for each unique
user in your app. You will not get meaningful aggregate reporting on so many parameter
values. Parameter values in the object must be of type String .
| |
valueToSum:Number (default = 0.0 ) — Value to associate with the event which will be summed up in Insights for
across all instances of the event, so that average values can be determined, etc.
|
See also
loginWithPublishPermissions | () | method |
public function loginWithPublishPermissions(permissions:Vector.<String> = null, listener:IAIRFacebookLoginListener = null):void
If user is not logged in then initiates user login with publish permissions otherwise requests publish permissions which have not been granted yet.
Parameters
permissions:Vector.<String> (default = null ) — List of publish permissions to request.
| |
listener:IAIRFacebookLoginListener (default = null ) — Object that will be notified about the login result.
|
loginResult: — Dispatched when the result
of the login process is obtained.
|
loginWithReadPermissions | () | method |
public function loginWithReadPermissions(permissions:Vector.<String> = null, listener:IAIRFacebookLoginListener = null):void
If user is not logged in then initiates user login with read permissions otherwise requests read permissions which have not been granted yet.
Parameters
permissions:Vector.<String> (default = null ) — List of read permissions to request.
| |
listener:IAIRFacebookLoginListener (default = null ) — Object that will be notified about the login result.
|
loginResult: — Dispatched when the result
of the login process is obtained.
|
logout | () | method |
public function logout(confirm:Boolean = false, title:String = Log out from Facebook?, message:String = You will not be able to connect with friends!, confirmLabel:String = Log out, cancelLabel:String = Cancel, listener:IAIRFacebookLogoutListener = null):void
Attempts to log out current user and clear cached access token.
Parameters
confirm:Boolean (default = false ) — Set to true to display native dialog asking user to confirm log out.
| |
title:String (default = Log out from Facebook? ) — Value for the title of the log out confirmation dialog.
| |
message:String (default = You will not be able to connect with friends! ) — Value for the message of the log out confirmation dialog.
| |
confirmLabel:String (default = Log out ) — Label for the confirm button.
| |
cancelLabel:String (default = Cancel ) — Label for the cancel button.
| |
listener:IAIRFacebookLogoutListener (default = null ) — Object that will be notified about the logout result.
|
logoutResult: — Dispatched when the result of the
logout process is obtained.
|
removeBasicUserProfileListener | () | method |
public function removeBasicUserProfileListener(listener:IAIRFacebookBasicUserProfileListener):void
Removes object that was added earlier using addBasicUserProfileListener
.
Parameters
listener:IAIRFacebookBasicUserProfileListener — Object to remove.
|
requestExtendedUserProfile | () | method |
public function requestExtendedUserProfile(fields:Vector.<String> = null, forceRefresh:Boolean = false, listener:IAIRFacebookExtendedUserProfileListener = null):ExtendedUserProfile
Requests extended user profile that may contain additional user properties
depending on the permissions that were granted to your app.
If forcing the refresh or the request has not been made earlier then listen
to AIRFacebookExtendedUserProfileEvent.PROFILE_LOADED
to get the result of this request.
If asynchronous request is not necessary then a cached value is returned.
Parameters
fields:Vector.<String> (default = null ) — Set of fields to pass to the request, e.g. name or link .
These fields represent the user's properties which will be available to read,
provided your app has necessary permissions to obtain them.
| |
forceRefresh:Boolean (default = false ) — Set to true if you want to refresh user data, for example
after your app was granted new permission.
| |
listener:IAIRFacebookExtendedUserProfileListener (default = null ) — Object that will be notified (if cached value is not used) about the request result.
|
ExtendedUserProfile — Cached ExtendedUserProfile from earlier request,
or null if cache does not exist or refresh is enforced.
|
profileLoaded: — Dispatched
if cached value is not used.
|
requestUserFriends | () | method |
public function requestUserFriends(fields:Vector.<String> = null, listener:IAIRFacebookUserFriendsListener = null):void
Requests user friends. Only those friends who have also installed your app are contained in the result.
Parameters
fields:Vector.<String> (default = null ) — Set of fields to pass to the request, e.g. name or link .
These fields represent the friends' properties which will be available to read,
provided your app has necessary permissions to obtain them.
| |
listener:IAIRFacebookUserFriendsListener (default = null ) — Object that will be notified about the request result.
|
userFriendsRequestResult: — Dispatched when the result
of the request is obtained.
|
requestUserProfilePicture | () | method |
public function requestUserProfilePicture(width:int, height:int, autoLoad:Boolean = false, listener:IAIRFacebookUserProfilePictureListener = null):String
Requests user's profile picture and optionally loads the picture. Basic user's profile must be ready in order to succeed with this call.
Parameters
width:int — The desired width for the profile picture, must be greater than 0.
| |
height:int — The desired height for the profile picture, must be greater than 0.
| |
autoLoad:Boolean (default = false ) — Set to true if you want the picture to be loaded.
| |
listener:IAIRFacebookUserProfilePictureListener (default = null ) — Object that will be notified about the auto-loaded profile picture.
|
String — The URI of the profile picture, or null if user's profile is not ready to be accessed.
|
profilePictureLoadResult: — Dispatched
if autoLoad is set to true .
|
See also