Packagecom.myflashlab.air.extensions.firebase.remoteConfig
Classpublic class RemoteConfig
InheritanceRemoteConfig Inheritance Object

Entry point for Firebase RemoteConfig. Callers should first init the object using RemoteConfig.init();, and then call the operations. The singleton object contains the complete set of Remote Config parameter values available to your app, including the Active Config and Default Config. This object also caches values fetched from the Remote Config Server until they are copied to the Active Config by calling activateFetched().



Public Properties
 PropertyDefined By
  fetchTime : Number
[static] [read-only] Gets the timestamp (milliseconds since epoch) of the last successful fetch, regardless of whether the fetch was activated or not.
RemoteConfig
  isDeveloperModeEnabled : Boolean
[static] [read-only] Returns true if the developer mode is enabled, false otherwise.
RemoteConfig
  lastFetchStatus : int
[static] [read-only] Gets the status of the most recent fetch attempt.
RemoteConfig
  listener : EventDispatcher
[static] [read-only] Deprecated, and will be removed in future versions.
RemoteConfig
Public Methods
 MethodDefined By
  
activateFetched():Boolean
[static] Activates the Fetched Config, so that the fetched key-values take effect.
RemoteConfig
  
fetch($cacheExpiration:Number, $callback:Function = null):void
[static] Fetches parameter values for your app.
RemoteConfig
  
fetchAndActivate($callback:Function = null):void
[static] Asynchronously fetches and then activates the fetched configs.
RemoteConfig
  
getSource($key:String):int
[static] Indicates at which source this value came from.
RemoteConfig
  
getValue($key:String, $type:int):*
[static] Get the value as the type you specified and corresponding to the specified key.
RemoteConfig
  
init():void
[static] Call this method once in your project to init the RemoteConfig in your app.
RemoteConfig
  
setConfigSettings($developerModeEnabled:Boolean):void
[static] Changes the settings for the FirebaseRemoteConfig object's operations, such as turning the developer mode on.
RemoteConfig
  
[static] Asynchronously changes the settings for this {
RemoteConfig
  
setDefaults($defaultValues:Object):void
[static] Sets default values.
RemoteConfig
Public Constants
 ConstantDefined By
  AS_BOOLEAN : int = 0
[static] Boolean representation of this parameter value.
RemoteConfig
  AS_NUMBER : int = 1
[static] Number representation of this parameter value.
RemoteConfig
  AS_STRING : int = 2
[static] String representation of this parameter value.
RemoteConfig
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.remoteConfig
[static]
RemoteConfig
  LAST_FETCH_STATUS_FAILURE : int = 1
[static] Indicates that the most recent attempt to fetch parameter values from the Remote Config Server has failed.
RemoteConfig
  LAST_FETCH_STATUS_NO_FETCH_YET : int = 0
[static] Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Remote Config Server.
RemoteConfig
  LAST_FETCH_STATUS_SUCCESS : int = -1
[static] Indicates that the most recent fetch of parameter values from the Remote Config Server was completed successfully.
RemoteConfig
  LAST_FETCH_STATUS_THROTTLED : int = 2
[static] Indicates that the most recent attempt to fetch parameter values from the Remote Config Server was throttled.
RemoteConfig
  VALUE_SOURCE_DEFAULT : int = 1
[static] Indicates that the value returned was retrieved from the Default Config.
RemoteConfig
  VALUE_SOURCE_REMOTE : int = 2
[static] Indicates that the value returned was retrieved from the Remote Config Server.
RemoteConfig
  VALUE_SOURCE_STATIC : int = 0
[static] Indicates that the value returned is the static default value.
RemoteConfig
  VERSION : String = 9.10.0
[static]
RemoteConfig
Property Detail
fetchTimeproperty
fetchTime:Number  [read-only]

Gets the timestamp (milliseconds since epoch) of the last successful fetch, regardless of whether the fetch was activated or not. Returns -1 if no fetch attempt has been made yet. Otherwise, returns the timestamp of the last successful fetch operation.


Implementation
    public static function get fetchTime():Number
isDeveloperModeEnabledproperty 
isDeveloperModeEnabled:Boolean  [read-only]

Returns true if the developer mode is enabled, false otherwise.


Implementation
    public static function get isDeveloperModeEnabled():Boolean
lastFetchStatusproperty 
lastFetchStatus:int  [read-only]

Gets the status of the most recent fetch attempt. Will return one of RemoteConfig.LAST_FETCH_STATUS_SUCCESS, RemoteConfig.LAST_FETCH_STATUS_FAILURE, RemoteConfig.LAST_FETCH_STATUS_THROTTLED, or RemoteConfig.LAST_FETCH_STATUS_NO_FETCH_YET.


Implementation
    public static function get lastFetchStatus():int
listenerproperty 
listener:EventDispatcher  [read-only]

Deprecated, and will be removed in future versions. Instead use the callback functions.


Implementation
    public static function get listener():EventDispatcher
Method Detail
activateFetched()method
public static function activateFetched():Boolean

Activates the Fetched Config, so that the fetched key-values take effect.

Returns
Boolean — true if there was a Fetched Config, and it was activated. false if no Fetched Config was found, or the Fetched Config was already activated.
fetch()method 
public static function fetch($cacheExpiration:Number, $callback:Function = null):void

Fetches parameter values for your app. Configuration values may be served from the Default Config (local cache) or from the Remote Config Server, depending on how much time has elapsed since parameter values were last fetched from the Remote Config server. This method lets the caller specify the cache expiration in seconds.

Parameters

$cacheExpiration:Number — If the data in the cache was fetched no longer than this many seconds ago, this method will return the cached data. If not, a fetch from the Remote Config Server will be attempted.
 
$callback:Function (default = null)function($error:Error):void is called when the request completes.

fetchAndActivate()method 
public static function fetchAndActivate($callback:Function = null):void

Asynchronously fetches and then activates the fetched configs.

If the time elapsed since the last fetch from the Firebase Remote Config backend is more than the default minimum fetch interval, configs are fetched from the backend.

After the fetch is complete, the configs are activated so that the fetched key value pairs take effect.

Parameters

$callback:Function (default = null)

getSource()method 
public static function getSource($key:String):int

Indicates at which source this value came from. RemoteConfig.VALUE_SOURCE_REMOTE if the value was retrieved from the server, RemoteConfig.VALUE_SOURCE_DEFAULT if the value was set as a default, or RemoteConfig.VALUE_SOURCE_STATIC if no value was found and a static default value was returned instead.

Parameters

$key:String

Returns
int
getValue()method 
public static function getValue($key:String, $type:int):*

Get the value as the type you specified and corresponding to the specified key.

NOTICE: THIS FEATURE IS ONLY AVAILABLE TO MYFLASHLABS CLUB MEMBERS: You can retrive value data as Boolean/Number/String but if you're not a club member, you can only receive String values. Receiving String values is good enough for most cases as you can easily convert a String to a Boolean or a Number. However by Joining the club, you are supporting the MyFlashLabs Team to be able to do their job with more ease.

Parameters

$key:String
 
$type:int

Returns
*
init()method 
public static function init():void

Call this method once in your project to init the RemoteConfig in your app. But do it after you have already initialized the core Firebase ANE.

setConfigSettings()method 
public static function setConfigSettings($developerModeEnabled:Boolean):void

Changes the settings for the FirebaseRemoteConfig object's operations, such as turning the developer mode on.

Parameters

$developerModeEnabled:Boolean

setConfigSettingsAsync()method 
public static function setConfigSettingsAsync(settings:RemoteConfigSettings):void

Asynchronously changes the settings for this {

Parameters

settings:RemoteConfigSettings — The new settings to be applied.

setDefaults()method 
public static function setDefaults($defaultValues:Object):void

Sets default values.

Parameters

$defaultValues:Object


Example
The Object parameter must be in key/value format like below
         var defaults:Object = {};
         defaults.key1 = "value1";
         defaults.key2 = 2;
         defaults.key3 = true;
         
Constant Detail
AS_BOOLEANConstant
public static const AS_BOOLEAN:int = 0

Boolean representation of this parameter value.

AS_NUMBERConstant 
public static const AS_NUMBER:int = 1

Number representation of this parameter value.

AS_STRINGConstant 
public static const AS_STRING:int = 2

String representation of this parameter value.

EXTENSION_IDConstant 
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.remoteConfig

LAST_FETCH_STATUS_FAILUREConstant 
public static const LAST_FETCH_STATUS_FAILURE:int = 1

Indicates that the most recent attempt to fetch parameter values from the Remote Config Server has failed.

LAST_FETCH_STATUS_NO_FETCH_YETConstant 
public static const LAST_FETCH_STATUS_NO_FETCH_YET:int = 0

Indicates that the FirebaseRemoteConfig singleton object has not yet attempted to fetch parameter values from the Remote Config Server.

LAST_FETCH_STATUS_SUCCESSConstant 
public static const LAST_FETCH_STATUS_SUCCESS:int = -1

Indicates that the most recent fetch of parameter values from the Remote Config Server was completed successfully.

LAST_FETCH_STATUS_THROTTLEDConstant 
public static const LAST_FETCH_STATUS_THROTTLED:int = 2

Indicates that the most recent attempt to fetch parameter values from the Remote Config Server was throttled.

VALUE_SOURCE_DEFAULTConstant 
public static const VALUE_SOURCE_DEFAULT:int = 1

Indicates that the value returned was retrieved from the Default Config.

VALUE_SOURCE_REMOTEConstant 
public static const VALUE_SOURCE_REMOTE:int = 2

Indicates that the value returned was retrieved from the Remote Config Server.

VALUE_SOURCE_STATICConstant 
public static const VALUE_SOURCE_STATIC:int = 0

Indicates that the value returned is the static default value.

VERSIONConstant 
public static const VERSION:String = 9.10.0