-
-
Notifications
You must be signed in to change notification settings - Fork 5
Remote Config Sample App Walkthrough
The contents of this page are based on the original Firebase Documentation
This guide walks you through the steps involved in integrating Remote Config into your AIR app.
The quickstart sample provides an example of using Remote Config to define the welcome message of the sample app. Before running the quickstart sample, you should set up a Remote Config project.
In the Firebase console, click Create New Project, and then follow the instructions to Set up a Firebase Remote Config Project with the following parameters:
Parameter key |
Default value |
Notes: |
---|---|---|
welcome_message | Welcome to this sample app | Change to use a different welcome message. |
welcome_message_caps | false | Set to true to have the welcome message display in all caps. |
First, the sample gets a Remote Config object instance and enables developer mode to allow for frequent refreshes of the cache:
remoteConfig = RemoteConfigANE.remoteConfig;
remoteConfig.configSettings = new RemoteConfigSettings(true);
Then, the sample sets in-app default values from an object:
remoteConfig.setDefaults(
{
"welcome_message_caps": false,
"welcome_message": "I am a default message"
}
);
Now, the sample creates a fetch request to fetch values from the Remote Config service and calls activateFetched to make those values available to the app:
remoteConfig.addEventListener(RemoteConfigEvent.FETCH, onRemoteConfig);
remoteConfig.fetch(expirationDuration);
Now that the welcome message has been updated, you can display the updated welcome message in the app:
private function onRemoteConfig(event:RemoteConfigEvent):void {
remoteConfig.activateFetched();
var message:String = remoteConfig.getString("welcome_message");
if (remoteConfig.getBoolean("welcome_message_caps")) {
message = message.toUpperCase();
}
trace(message);
}
You can access your Remote Config parameters using one of the getString, getNumber, getByteArray, or getBoolean properties.
Remote Config caches values locally after the first successful request. By default the cache expires after 12 hours, but you can change the cache expiration for a specific request by passing the desired cache expiration, in seconds, to fetch(). If the values in the cache are older than the desired cache expiration, Remote Config will request fresh config values from the service. If your app requests fresh values using fetch() several times, requests are throttled and your app is provided with a cached value.
Note: Throttling is done from within the SDK. An app can fetch a maximum of 5 times in a 60 minute window before the SDK begins to throttle and returns RemoteConfigFetchStatus.THROTTLED.
Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
Project setup
Analytics
Authentication
Dynamic Links
Google Sign In
Firestore
- Configuring the ANE
- Get Started
- Add and Manage Data
- Query Data
- Get Data
- Get Realtime Updates
- Perform Simple and Compound Queries
- Order and Limit Data
- Paginate Data
Messaging
One Signal
Performance
Remote Config
Storage
- Configuring the ANE
- Get Started
- Create a Reference
- Upload Files
- Download Files
- Use File Metadata
- Delete Files
Crashlytics
Vision
- Detect faces
- Scan barcodes
- Label images
- Recognize landmarks
- Natural Language
- Custom Models
External Links