ExzileGames.AndroidFcmBridge 1.0.25

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

AndroidFcmBridge

A Java bridge + C# interop library for Firebase Cloud Messaging (FCM) on .NET Android. Provides async token retrieval, topic subscriptions, and push message callbacks for re-engagement notifications.

Problem

FirebaseMessagingService must be subclassed in Java and registered in the Android manifest — it cannot be implemented in C# alone. Without a compiled Java subclass, FCM token refresh events and incoming push messages are never delivered to your app.

Solution

This library compiles a FirebaseMessagingService subclass (ExzileFcmService) directly into your Android project. It forwards token refreshes and incoming messages to your C# code via auto-generated JNI bindings, with no manual Java callback wiring required.

APIs Exposed

API Methods
Token GetTokenAsync, SetTokenRefreshListener
Topics SubscribeToTopicAsync, UnsubscribeFromTopicAsync
Messages SetMessageListener

Setup

1. Add NuGet package

dotnet add package ExzileGames.AndroidFcmBridge

2. Add google-services.json

Place your google-services.json (from the Firebase Console) in the Android app project root:

<GoogleServicesJson Include="google-services.json" />

3. Register the service in AndroidManifest.xml

<service android:name="com.exzilegames.fcmbridge.ExzileFcmService"
         android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

4. Initialize in your Activity

using AndroidFcmBridge.Interop;

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);

    var fcm = new AndroidFcmBridgeImpl(this);
    FcmBridgeManager.SetImplementation(fcm);
}

5. Use from shared code

using AndroidFcmBridge.Interop;

// Register listeners before calling GetTokenAsync to avoid missing the first refresh
FcmBridgeManager.SetTokenRefreshListener(token =>
{
    // Send updated token to your server
    Console.WriteLine($"New FCM token: {token}");
});

FcmBridgeManager.SetMessageListener(message =>
{
    Console.WriteLine($"Push received: {message.Title} — {message.Body}");
    foreach (var (key, value) in message.Data)
        Console.WriteLine($"  {key} = {value}");
});

// Retrieve current token
var result = await FcmBridgeManager.GetTokenAsync();
if (result.Success)
    Console.WriteLine($"FCM token: {result.Token}");

// Subscribe/unsubscribe topics
await FcmBridgeManager.SubscribeToTopicAsync("news");
await FcmBridgeManager.UnsubscribeFromTopicAsync("news");

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 108 4/9/2026
1.0.24 105 4/9/2026