Firebase Remote Config
Tested with Firebase version 12.2.0 (iOS)
Using Appfigurate remote properties instead of Firebase APIs directly allows for the following:
locally change Firebase remote configuration without affecting your entire customer base.
compile time type safety - Appfigurate remote properties are typed.
avoids hardcoding duplicated flag names throughout your app.
deleting a remote configuration property from Firebase Console won't affect existing apps, they'll continue to use the default value provided in the
resetmethod.
We assume you already have Appfigurate Library and Firebase integrated into your app with the following example remote properties created in the Firebase Console:

Add remote properties into your Configuration subclass
Update your configuration subclass to include your remote configuration properties. Provide default values for the properties in the overridden reset method. See also Supported property types.
Swift Configuration example
Objective-C Configuration header example
Objective-C Configuration implementation example
Kotlin Configuration example
Java Configuration example
Provide remote configuration values to Appfigurate Library when requested
Appfigurate Library needs to be able to read the current remote configuration values from Firebase. Copy and paste the following code into your app.
The defaultValue parameter in the callback is not used with Firebase. See the Apply default values for Firebase section below.
Swift example
Objective-C example
Kotlin example
Java example
Apply default values to Firebase
Apply default values to Firebase using the values you set in the reset method of your configuration subclass. The default values are used by Firebase when the remote configuration has not yet been received.
The APLConfiguration class has a method remoteDefaults which provides a Dictionary of all the remote configuration property default values that were set in your overridden reset method.
Swift example
The APLConfiguration class has a method remoteDefaults which provides a NSDictionary* of all the remote configuration property default values that were set in your overridden reset method.
Objective-C example
The nz.co.electricbolt.appfiguratelibrary.Configuration class has a method remoteDefaults which provides a HashMap<String,Object> of all the remote configuration property default values that were set in your overridden reset method.
Kotlin example
The nz.co.electricbolt.appfiguratelibrary.Configuration class has a method remoteDefaults which provides a HashMap<String,Object> of all the remote configuration property default values that were set in your overridden reset method.
Java example
Notify Appfigurate Library when Firebase has received remote configuration values
We need to tell Appfigurate Library that Firebase has received remote configuration, so that it can keep your Configuration subclass remote properties in sync.
Add a call to APLFlushRemoteConfiguration in any existing Firebase Remote Config activate(completion:) blocks (inside fetch(completionHandler:) and optionally addOnConfigUpdateListener(remoteConfigUpdateCompletion:).
Swift example
Add a call to APLFlushRemoteConfiguration in any existing Firebase Remote Config activateWithCompletion: blocks (inside fetchWithCompletionHandler: and optionally addOnConfigUpdateListener:).
Objective-C example
Add a call to Appfigurate.flushRemoteConfiguration in your existing Firebase Remote Config fetchAndActivate block:
Kotlin fetch and activate example
If you are optionally using Firebase Remote Config real time updates add a call to Appfigurate.flushRemoteConfiguration in your existing addOnConfigUpdateListener block:
Kotlin real time update example
Add a call to Appfigurate.flushRemoteConfiguration in your existing Firebase Remote Config fetchAndActivate block:
Java fetch and activate example
If you are optionally using Firebase Remote Config real time updates add a call to Appfigurate.flushRemoteConfiguration in your existing addOnConfigUpdateListener block:
Java real time update example
Complete initialisation example
Swift complete initialisation example
Objective-C complete initialisation example
Kotlin complete initialisation example
Java complete initialisation example
Best practice and usage
Replace all calls to Firebase Remote Config configValue(forKey:):
with the following:
Replace all calls to Firebase Remote Config configValueForKey:
with the following:
Replace all calls to Firebase Remote Config getBoolean(), getLong(), getDouble(), getString()
with the following:
Replace all calls to Firebase Remote Config getBoolean(), getLong(), getDouble(), getString()
with the following:
Last updated