Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

C.3 Init Remote Config

Hadi Tavakoli edited this page Jun 16, 2019 · 2 revisions

Initialize Firebase Remote Config

You can initialize the Remote Config by calling RemoteConfig.init(); As soon as you initialized the firebaseRemoteConfig.ane in your project, you will be ready to set default values and fetch server values from the ANE. When you are developing your app, you may wish to set the developer mode on by passing true to RemoteConfig.setConfigSettings(true);

NOTE: Make sure you have already initialized the Firebase core before trying any other Firebase child ANEs.

Set in-app default parameter values

You can set in-app default parameter values in the Remote Config object, so that your app behaves as intended before it connects to the Remote Config Server, and so that default values are available if none are set on the server.

  • Define a set of parameter names, and default parameter values using a key/value formatted ActionScript Object.
var myDefaults:Object = {};
myDefaults["first_key"] = "my first default value";
myDefaults["second_key"] = "my second default value";

Get parameter values to use in your app

Now you can get parameter values from the Remote Config object. If you set values on the Remote Config server, fetched them, and then activated them, those values are available to your app. Otherwise, you will get the in-app parameter values configured using RemoteConfig.setDefaults(). To get these values, call RemoteConfig.getValue()

var value:String = RemoteConfig.getValue("first_key", RemoteConfig.AS_STRING) as String;

Fetch and activate values from the server (as needed)

  • To fetch parameter values from the Remote Config Server, call the fetch() method. Any values that you set on the Remote Config Server are fetched and cached in the Remote Config object.
  • To make fetched parameter values available to your app, call the activateFetched() method.
var cacheExpiration:Number = 3600; // 3600 seconds means 1 hour			
trace("isDeveloperModeEnabled = "   RemoteConfig.isDeveloperModeEnabled);
				
if (RemoteConfig.isDeveloperModeEnabled)
{
	// If in developer mode cacheExpiration is set to 0 so each fetch will retrieve values from the server.
	cacheExpiration = 0;
}
				
RemoteConfig.fetch(cacheExpiration, function ($error:Error):void
{
	if($error)
	{
		trace($error.message);
	}
	else
	{
		trace("Fetch was successful, Now, let's call RemoteConfig.activateFetched() to activate the new data");
						
		// When you fetch the new information from server, you can activate them anytime you think is appropriate in your app
		RemoteConfig.activateFetched();
	}
});

Because these updated parameter values affect the behavior and appearance of your app, you should activate the fetched values at a time that ensures a smooth experience for your user, such as the next time that the user opens your app.

Introduction to Firebase ANEs collection for Adobe Air apps


Get Started with Firebase Core in AIR

  1. Prerequisites
  2. Add Firebase to your app
  3. Add the Firebase SDK
  4. Init Firebase Core
  5. Available ANEs
  6. Managing Firebase iid

Get Started with Analytics

  1. Add Analytics ANE
  2. Init Analytics ANE
  3. Log Events
  4. Set User Properties

Get Started with Crashlytics

  1. Add Crashlytics ANE
  2. Test Your Implementation
  3. Customize Crash Reports
  4. Upload .dSYM for iOS apps

Get Started with DynamicLinks

  1. Add DynamicLinks ANE
  2. Init DynamicLinks ANE
  3. Create DynamicLinks
  4. Receive DynamicLinks
  5. View Analytics

Get Started with Authentication

  1. Add Authentication
  2. Init Authentication
  3. Manage Users
  4. Phone Number
  5. Custom Auth
  6. Anonymous Auth
  7. State in Email Actions
  8. Email Link Authentication

Get Started with FCM OneSignal

  1. Add FCM ANE
  2. Init FCM ANE
  3. Send Your 1st Message
  4. Send Msg to Topics
  5. Understanding FCM Messages
  6. init OneSignal

Get Started with Firestore

  1. Add Firestore
  2. Init Firestore
  3. Add Data
  4. Transactions & Batches
  5. Delete Data
  6. Manage the Console
  7. Get Data
  8. Get Realtime Updates
  9. Simple and Compound
  10. Order and Limit Data
  11. Paginate Data
  12. Manage Indexes
  13. Secure Data
  14. Offline Data
  15. Where to Go From Here

Get Started with Realtime Database

  1. Add Realtime Database
  2. Init Realtime Database
  3. Structure Your Database
  4. Save Data
  5. Retrieve Data
  6. Enable Offline Capabilities

Get Started with Remote Config

  1. Parameters and Conditions
  2. Add Remote Config
  3. Init Remote Config

Get Started with Performance

  1. Add Performance ANE
  2. Init & Start Monitoring

Get Started with Storage

  1. Add Storage ANE
  2. Init Storage ANE
  3. Upload Files to Storage
  4. Download Files to Air
  5. Use File Metadata
  6. Delete Files

Get Started with Functions

  1. Write & Deploy Functions
  2. Add Functions ANE
  3. Init Functions
Clone this wiki locally