Packagecom.myflashlab.air.extensions.firebase.core
Classpublic class Firebase
InheritanceFirebase Inheritance Object

Firebase class is the core ANE you need to initialize before being able to run any of the other Firebase features.

Read this wiki https://github.com/myflashlab/Firebase-ANE/wiki to learn how to initialize the ANE in your project.



Public Properties
 PropertyDefined By
  dataCollectionDefaultEnabled : Boolean
[static] Gets or sets whether automatic data collection is enabled for all products.
Firebase
  iid : FirebaseInstanceId
[static] [read-only] Gives you access to the Firebase Instance ID library to allow you manage the instance ID which is also known as iid.
Firebase
  isConnectedToGoogleApiClient : Boolean
[static] [read-only] (Android) Indicates if the ANE is connected to the GoogleApiClient.
Firebase
  os : String
[static] [read-only] (Deprecated, instead use the OverrideAir.os property) Indicates if you are running this ANE on Android or iOS platforms.
Firebase
Public Methods
 MethodDefined By
  
checkGoogleAvailability($callback:Function):void
[static] (Android) Checks if the minimum Google Play Services SDK is available or not.
Firebase
  
[static] This method returns the Firebase configuration details based on GoogleService-Info.plist for iOS and google-services.json for Android.
Firebase
  
init($prepareForDynamicLinks:Boolean = false):Boolean
[static] Call this method to initialize the Firebase.
Firebase
  
makeGooglePlayServicesAvailable($callback:Function):void
[static] (Android) Attempts to make Google Play services available on this device.
Firebase
  
setLoggerLevel($level:int):void
[static] Sets the logging level for internal Firebase logging.
Firebase
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.core
[static]
Firebase
  FIREBASE_SDK_ANDROID : String = 17.2.1
[static]
Firebase
  FIREBASE_SDK_IOS : String = 6.18.0
[static]
Firebase
  SERVICE_DISABLED : int = 3
[static] The installed version of Google Play services has been disabled on this device.
Firebase
  SERVICE_INVALID : int = 9
[static] The version of the Google Play services installed on this device is not authentic.
Firebase
  SERVICE_MISSING : int = 1
[static] Google Play services is missing on this device.
Firebase
  SERVICE_UPDATING : int = 18
[static] Google Play service is currently being updated on this device.
Firebase
  SERVICE_VERSION_UPDATE_REQUIRED : int = 2
[static] The installed version of Google Play services is out of date.
Firebase
  SUCCESS : int = 0
[static] The connection was successful.
Firebase
  VERSION : String = 9.9.0
[static]
Firebase
Property Detail
dataCollectionDefaultEnabledproperty
dataCollectionDefaultEnabled:Boolean

Gets or sets whether automatic data collection is enabled for all products. Defaults to `true` unless `FirebaseDataCollectionDefaultEnabled` is set to `false` in your app's Info.plist. This value is persisted across runs of the app so that it can be set once when users have consented to collection.


Implementation
    public static function get dataCollectionDefaultEnabled():Boolean
    public static function set dataCollectionDefaultEnabled(value:Boolean):void
iidproperty 
iid:FirebaseInstanceId  [read-only]

Gives you access to the Firebase Instance ID library to allow you manage the instance ID which is also known as iid.


Implementation
    public static function get iid():FirebaseInstanceId
isConnectedToGoogleApiClientproperty 
isConnectedToGoogleApiClient:Boolean  [read-only]

(Android) Indicates if the ANE is connected to the GoogleApiClient. NOTE:There is really nothing on your side to be done in regard to how the ANE connects to GoogleApiClient. However we have set these properties public because we might need that in future versions.


Implementation
    public static function get isConnectedToGoogleApiClient():Boolean
osproperty 
os:String  [read-only]

(Deprecated, instead use the OverrideAir.os property) Indicates if you are running this ANE on Android or iOS platforms.


Implementation
    public static function get os():String
Method Detail
checkGoogleAvailability()method
public static function checkGoogleAvailability($callback:Function):void

(Android) Checks if the minimum Google Play Services SDK is available or not. Some of the Firebase features like the FCM is dependent on Google Play Services SDK and this method will help you make sure if the feature can function correctly on user's device or not.

(iOS) will always return Firebase.SUCCESS

Parameters

$callback:Function — ANE will check Google Services SDK availability and returns the result to this function.


Example
You can check GoogleAvailability like this:
         Firebase.checkGoogleAvailability(onCheckResult);
         
         private function onCheckResult($result:int):void
         {
             switch($result)
             {
                 case Firebase.SUCCESS:
                     
                     trace("checkGoogleAvailability result = SUCCESS");
                     
                 break;
                 case Firebase.SERVICE_MISSING:
                     
                     trace("checkGoogleAvailability result = SERVICE_MISSING");
                     
                 break;
                 case Firebase.SERVICE_VERSION_UPDATE_REQUIRED:
                     
                     trace("checkGoogleAvailability result = SERVICE_VERSION_UPDATE_REQUIRED");
                     
                 break;
                 case Firebase.SERVICE_UPDATING:
                     
                     trace("checkGoogleAvailability result = SERVICE_UPDATING");
                     
                 break;
                 case Firebase.SERVICE_DISABLED:
                     
                     trace("checkGoogleAvailability result = SERVICE_DISABLED");
                     
                 break;
                 case Firebase.SERVICE_INVALID:
                     
                     trace("checkGoogleAvailability result = SERVICE_INVALID");
                     
                 break;
             }
         }
         
getConfig()method 
public static function getConfig():FirebaseConfig

This method returns the Firebase configuration details based on GoogleService-Info.plist for iOS and google-services.json for Android.

Moreover, you can set WebApiKey into this object. Some Firebase child ANEs may need this information. Some of the child ANEs which need this are for example the DynamicLinks ANE.

Returns
FirebaseConfig
init()method 
public static function init($prepareForDynamicLinks:Boolean = false):Boolean

Call this method to initialize the Firebase. You must init Firebase the soonest possible in your app.

Parameters

$prepareForDynamicLinks:Boolean (default = false) — Set this to true if you are going to use the DynamicLinks ANE in your app.

Returns
Boolean — returns true if the Firebase configuration has been found.

Example
If you are setting the $prepareForDynamicLinks parameter to true, make sure you are setting your custom scheme key in your manifest .xml file as follow:
         <key>com.myflashlabs.firebase.deepLinkURLScheme</key>
         <string>YourCustomSchemeString</string>
         
makeGooglePlayServicesAvailable()method 
public static function makeGooglePlayServicesAvailable($callback:Function):void

(Android) Attempts to make Google Play services available on this device. If Play Services is already available, the $callback may be called immediately.

(iOS) the $callback will be called immediately with no error.

Parameters

$callback:Function


Example
Make Google Play Service available on an Android device if it's not already.
         Firebase.makeGooglePlayServicesAvailable(onResult);
                  private function onResult($error:Error):void
         {
             if($error)
             {
                 trace($error.message);
             }
             else
             {
                 trace("Success");
             }
         }
         
setLoggerLevel()method 
public static function setLoggerLevel($level:int):void

Sets the logging level for internal Firebase logging.

Parameters

$level:int (default = NaN) — can be one of the following values:
  • FirebaseConfig.LOGGER_LEVEL_MIN
  • FirebaseConfig.LOGGER_LEVEL_NOTICE
  • FirebaseConfig.LOGGER_LEVEL_MAX

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.core

FIREBASE_SDK_ANDROIDConstant 
public static const FIREBASE_SDK_ANDROID:String = 17.2.1

FIREBASE_SDK_IOSConstant 
public static const FIREBASE_SDK_IOS:String = 6.18.0

SERVICE_DISABLEDConstant 
public static const SERVICE_DISABLED:int = 3

The installed version of Google Play services has been disabled on this device.

SERVICE_INVALIDConstant 
public static const SERVICE_INVALID:int = 9

The version of the Google Play services installed on this device is not authentic.

SERVICE_MISSINGConstant 
public static const SERVICE_MISSING:int = 1

Google Play services is missing on this device.

SERVICE_UPDATINGConstant 
public static const SERVICE_UPDATING:int = 18

Google Play service is currently being updated on this device.

SERVICE_VERSION_UPDATE_REQUIREDConstant 
public static const SERVICE_VERSION_UPDATE_REQUIRED:int = 2

The installed version of Google Play services is out of date.

SUCCESSConstant 
public static const SUCCESS:int = 0

The connection was successful.

VERSIONConstant 
public static const VERSION:String = 9.9.0