ExzileGames.AndroidRemoteConfigBridge 1.0.25

dotnet add package ExzileGames.AndroidRemoteConfigBridge --version 1.0.25
                    
NuGet\Install-Package ExzileGames.AndroidRemoteConfigBridge -Version 1.0.25
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExzileGames.AndroidRemoteConfigBridge" Version="1.0.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExzileGames.AndroidRemoteConfigBridge" Version="1.0.25" />
                    
Directory.Packages.props
<PackageReference Include="ExzileGames.AndroidRemoteConfigBridge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ExzileGames.AndroidRemoteConfigBridge --version 1.0.25
                    
#r "nuget: ExzileGames.AndroidRemoteConfigBridge, 1.0.25"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ExzileGames.AndroidRemoteConfigBridge@1.0.25
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ExzileGames.AndroidRemoteConfigBridge&version=1.0.25
                    
Install as a Cake Addin
#tool nuget:?package=ExzileGames.AndroidRemoteConfigBridge&version=1.0.25
                    
Install as a Cake Tool

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:

  • FetchAndActivateAsync is unwrapped into a typed RemoteConfigFetchResult record with activated and success fields.
  • SetDefaults calls setDefaultsAsync(Map) via Android.Runtime.JNIEnv since 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.25 104 4/9/2026
1.0.24 109 4/9/2026