ExzileGames.AndroidAnalyticsBridge 1.0.25

dotnet add package ExzileGames.AndroidAnalyticsBridge --version 1.0.25
                    
NuGet\Install-Package ExzileGames.AndroidAnalyticsBridge -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.AndroidAnalyticsBridge" Version="1.0.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExzileGames.AndroidAnalyticsBridge" Version="1.0.25" />
                    
Directory.Packages.props
<PackageReference Include="ExzileGames.AndroidAnalyticsBridge" />
                    
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.AndroidAnalyticsBridge --version 1.0.25
                    
#r "nuget: ExzileGames.AndroidAnalyticsBridge, 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.AndroidAnalyticsBridge@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.AndroidAnalyticsBridge&version=1.0.25
                    
Install as a Cake Addin
#tool nuget:?package=ExzileGames.AndroidAnalyticsBridge&version=1.0.25
                    
Install as a Cake Tool

AndroidAnalyticsBridge

A pure C# wrapper for Firebase Analytics on .NET Android. Provides a clean Dictionary<string, object>-based event logging API over the Xamarin Firebase Analytics binding — no manual Bundle construction or JNI parameter packing required in your app code.

Problem

Using Xamarin.Firebase.Analytics directly requires constructing an Android Bundle object and calling typed Put* methods (PutString, PutLong, etc.) for every event parameter. This is verbose, platform-specific, and cannot be called from shared cross-platform code.

Solution

This bridge wraps the Xamarin binding with a Dictionary<string, object> API. It inspects each value's runtime type and calls the correct Put* method automatically, so you write platform-agnostic C# and the bridge handles the Android-specific plumbing.

Setup

1. Add NuGet package

dotnet add package ExzileGames.AndroidAnalyticsBridge

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" />

Firebase Analytics will not initialize without it.

3. Initialize in your Activity

using AndroidAnalyticsBridge.Interop;

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    AnalyticsBridgeManager.SetImplementation(new AndroidAnalyticsBridgeImpl(this));
}

4. Use from shared code

using AndroidAnalyticsBridge.Interop;

// Log a simple event
AnalyticsBridgeManager.LogEvent("level_complete");

// Log an event with parameters
AnalyticsBridgeManager.LogEvent("purchase", new Dictionary<string, object>
{
    ["item_id"]  = "redchest500",
    ["value"]    = 4.99,
    ["currency"] = "USD"
});

// Set user ID (pass null to clear)
AnalyticsBridgeManager.SetUserId("user-12345");

// Set a custom user property (pass null to clear)
AnalyticsBridgeManager.SetUserProperty("player_tier", "gold");

// Disable collection (e.g. for GDPR opt-out)
AnalyticsBridgeManager.SetAnalyticsCollectionEnabled(false);

// Get the Firebase app instance ID
string? instanceId = await AnalyticsBridgeManager.GetAppInstanceIdAsync();

Supported Parameter Types

C# Type Firebase Bundle Method
string PutString
int PutInt
long PutLong
float PutFloat
double PutDouble
bool PutBoolean
anything else PutString via ToString()

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 107 4/9/2026
1.0.24 106 4/9/2026