ExzileGames.AndroidRemoteConfigBridge
1.0.25
dotnet add package ExzileGames.AndroidRemoteConfigBridge --version 1.0.25
NuGet\Install-Package ExzileGames.AndroidRemoteConfigBridge -Version 1.0.25
<PackageReference Include="ExzileGames.AndroidRemoteConfigBridge" Version="1.0.25" />
<PackageVersion Include="ExzileGames.AndroidRemoteConfigBridge" Version="1.0.25" />
<PackageReference Include="ExzileGames.AndroidRemoteConfigBridge" />
paket add ExzileGames.AndroidRemoteConfigBridge --version 1.0.25
#r "nuget: ExzileGames.AndroidRemoteConfigBridge, 1.0.25"
#:package ExzileGames.AndroidRemoteConfigBridge@1.0.25
#addin nuget:?package=ExzileGames.AndroidRemoteConfigBridge&version=1.0.25
#tool nuget:?package=ExzileGames.AndroidRemoteConfigBridge&version=1.0.25
AndroidRemoteConfigBridge
A C# wrapper for Firebase Remote Config on .NET Android. Fixes the Xamarin binding's FetchAndActivateAsync() returning Task<Java.Lang.Object> (a boxed bool) and provides a typed API for feature flags and live-ops configuration.
Problem
The Xamarin.Firebase.Config binding's FetchAndActivateAsync returns Task<Java.Lang.Object> instead of Task<bool>, requiring an unsafe cast to read the activation result. Additionally, SetDefaultsAsync only exposes the int (XML resource ID) overload — the Map-based overload is absent from the binding entirely and must be called via JNI.
Solution
This bridge wraps both issues:
FetchAndActivateAsyncis unwrapped into a typedRemoteConfigFetchResultrecord withactivatedandsuccessfields.SetDefaultscallssetDefaultsAsync(Map)viaAndroid.Runtime.JNIEnvsince the binding doesn't expose it.
Setup
1. Add NuGet package
dotnet add package ExzileGames.AndroidRemoteConfigBridge
2. Add google-services.json
Place your google-services.json (from the Firebase Console) in the Android app project root and set its build action:
<GoogleServicesJson Include="google-services.json" />
3. Register the implementation in your Activity
using AndroidRemoteConfigBridge.Interop;
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
RemoteConfigBridgeManager.SetImplementation(new AndroidRemoteConfigBridgeImpl());
}
4. Use from shared code
using AndroidRemoteConfigBridge.Interop;
// Set in-app defaults used before the first fetch completes
RemoteConfigBridgeManager.SetDefaults(new Dictionary<string, object>
{
["enable_new_feature"] = false,
["max_lives"] = 5L,
["difficulty_scale"] = 1.0,
["welcome_message"] = "Hello!"
});
// Fetch and activate latest values from Firebase
var result = await RemoteConfigBridgeManager.FetchAndActivateAsync();
if (result.Success)
{
bool featureEnabled = RemoteConfigBridgeManager.GetBool("enable_new_feature");
long maxLives = RemoteConfigBridgeManager.GetLong("max_lives");
double scale = RemoteConfigBridgeManager.GetDouble("difficulty_scale");
string message = RemoteConfigBridgeManager.GetString("welcome_message");
}
// Bypass the 12-hour cache during development
var devResult = await RemoteConfigBridgeManager.FetchAndActivateAsync(TimeSpan.Zero);
API
| Method | Description |
|---|---|
FetchAndActivateAsync(TimeSpan?) |
Fetches latest config and activates it. Returns whether new values were activated. Pass TimeSpan.Zero to bypass the 12-hour cache. |
SetDefaults(IDictionary<string, object>) |
Sets in-app defaults used before the first successful fetch. |
GetString(key, defaultValue) |
Returns a config value as string. |
GetBool(key, defaultValue) |
Returns a config value as bool. |
GetLong(key, defaultValue) |
Returns a config value as long. |
GetDouble(key, defaultValue) |
Returns a config value as double. |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net10.0-android36.0
- Xamarin.Firebase.Config (>= 123.0.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.