Packagecom.myflashlab.air.extensions.gSignIn
Classpublic class GSignIn
InheritanceGSignIn Inheritance Object

Entry point for the Google Sign In API. Call GSignIn.signin(); to initialize the ANE.



Public Properties
 PropertyDefined By
  listener : EventDispatcher
[static] [read-only] use this property to attach the ANE listeners.
GSignIn
  rest : GRest
[static] [read-only]
GSignIn
  signedInAccount : GAccount
[static] [read-only] Gets the last account that the user signed in with.
GSignIn
Public Methods
 MethodDefined By
  
hasPermissions($scopes:Array):Boolean
[static] Determines if the given account has been granted permission to all scopes associated with the given extension.
GSignIn
  
init($options:GSignInOptions):void
[static] Initialize the GSignin ANE as soon as you can in your app.
GSignIn
  
requestPermissions($scopes:Array):void
[static] Requests a collection of permissions to be granted to the given account.
GSignIn
  
[static] Revokes access given to the current application.
GSignIn
  
signin():void
[static] Starts the sign-in process.
GSignIn
  
signOut():void
[static] Signs out the current signed-in user if any.
GSignIn
  
[static] Returns the GAccount object for the user who has previously signed into the app using the signin method.
GSignIn
Public Constants
 ConstantDefined By
  ANDROID_SDK_VERSION : String = 17.0.0
[static]
GSignIn
  EXTENSION_ID : String = com.myflashlab.air.extensions.google.signin
[static]
GSignIn
  IOS_SDK_VERSION : String = 5.0.2
[static]
GSignIn
  VERSION : String = 4.0.0
[static]
GSignIn
Property Detail
listenerproperty
listener:EventDispatcher  [read-only]

use this property to attach the ANE listeners.


Implementation
    public static function get listener():EventDispatcher
restproperty 
rest:GRest  [read-only]


Implementation
    public static function get rest():GRest
signedInAccountproperty 
signedInAccount:GAccount  [read-only]

Gets the last account that the user signed in with. Return GAccount from last known successful sign-in. If user has never signed in before or has signed out / revoked access, null is returned.


Implementation
    public static function get signedInAccount():GAccount
Method Detail
hasPermissions()method
public static function hasPermissions($scopes:Array):Boolean

Determines if the given account has been granted permission to all scopes associated with the given extension.

Parameters

$scopes:Array — the collection of scopes to be checked.

Returns
Boolean — true if the given account has been granted permission to all given scopes.
init()method 
public static function init($options:GSignInOptions):void

Initialize the GSignin ANE as soon as you can in your app. You can call GSignIn.signin(); or other methods of the ANE, later when you want them but try to init the ANE as soon as possible anyhow.

Parameters

$options:GSignInOptions — This is an instance of GSignInOptions class which lets the ANE know the default signin options. Refer to the GSignInOptions asdoc to know which options you can set. but it's important that we talk about one of them, the requestScopes. This property, lets you add signin scopes at the first try. These scopes can be found in the GScopes class. However, it is recommended by Google not to set this property simply because most users would be scared of apps which ask them too much permissions. So, it's generally a good idea not to ask for extra scope permissions with the initial signin and instead use the GSignIn.requestPermissions method whenever your app really needs a scope access.

requestPermissions()method 
public static function requestPermissions($scopes:Array):void

Requests a collection of permissions to be granted to the given account. If the account does not have the requested permissions the user will be presented with a UI for accepting them. Once the user has accepted or rejected a response will returned via GSignInEvents.REQUEST_PERMISSION_SUCCESS or GSignInEvents.REQUEST_PERMISSION_FAILURE.

Before calling this method, you should always call GSignIn.hasPermissions to make sure the scope you are requestion access to is not already available.

Notice: We are not sure if this is a bug or its happening by design but on the iOS side, when you start your app after user had been signedin in former launches, the returned GAccount object does not included the previously requested scopes! and when you check for them using the hasPermissions method, it returns false! However, the good news is that in this case, when you call requestPermissions with the missing scopes, these permissions will be returned successfully with the REQUEST_PERMISSION_SUCCESS event and no google window would be opened. So the user experience will be just similar to the Android's side anyhow.

Parameters

$scopes:Array — the extra collection of scopes to be requested.

revokeAccess()method 
public static function revokeAccess():void

Revokes access given to the current application. Future sign-in attempts will require the user to re-consent to all requested scopes. Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.

RevokeAccess result will be dispatched via the following events: GSignInEvents.REVOKE_ACCESS_SUCCESS, GSignInEvents.REVOKE_ACCESS_FAILURE.

signin()method 
public static function signin():void

Starts the sign-in process. Notice that you must call this method only after user has clicked on the signin button. To check if user can be logged in automatically, you should use the silentSignIn method.

Signin result will be dispatched via the following events: GSignInEvents.SIGNIN_SUCCESS, GSignInEvents.SIGNIN_FAILURE.

signOut()method 
public static function signOut():void

Signs out the current signed-in user if any. It also clears the account previously selected by the user and a future sign in attempt will require the user pick an account again.

SignOut result will be dispatched via the following events: GSignInEvents.SIGNOUT_SUCCESS, GSignInEvents.SIGNOUT_FAILURE.

silentSignIn()method 
public static function silentSignIn():void

Returns the GAccount object for the user who has previously signed into the app using the signin method. If user has not signed out or revoked her access, this method will silently signin the user without showin anu UI.

SilentSignIn result will be dispatched via the following events: GSignInEvents.SILENT_SIGNIN_SUCCESS, GSignInEvents.SILENT_SIGNIN_FAILURE.

Constant Detail
ANDROID_SDK_VERSIONConstant
public static const ANDROID_SDK_VERSION:String = 17.0.0

EXTENSION_IDConstant 
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.google.signin

IOS_SDK_VERSIONConstant 
public static const IOS_SDK_VERSION:String = 5.0.2

VERSIONConstant 
public static const VERSION:String = 4.0.0