ExzileGames.AndroidFcmBridge 1.0.24

There is a newer version of this package available.
See the version list below for details.
dotnet add package ExzileGames.AndroidFcmBridge --version 1.0.24
                    
NuGet\Install-Package ExzileGames.AndroidFcmBridge -Version 1.0.24
                    
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.24" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExzileGames.AndroidFcmBridge" Version="1.0.24" />
                    
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.24
                    
#r "nuget: ExzileGames.AndroidFcmBridge, 1.0.24"
                    
#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.24
                    
#: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.24
                    
Install as a Cake Addin
#tool nuget:?package=ExzileGames.AndroidFcmBridge&version=1.0.24
                    
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 subscription, 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. This library handles the Java side for you, forwarding token refreshes and incoming messages to your C# code via auto-generated JNI bindings.

APIs Exposed

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

Setup

1. Add google-services.json

Place your project's google-services.json file in the root of the consuming Android project. This file is obtained from the Firebase console and is required for FCM to initialise.

2. Register the service in AndroidManifest.xml

The ExzileFcmService must be declared in the consuming project's AndroidManifest.xml so that the Android system can route FCM events to the bridge:

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

3. Add project reference

<ProjectReference Include="..\AndroidFcmBridge\AndroidFcmBridge.csproj" />

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;

// Listen for token refreshes (call before GetTokenAsync to avoid missing the first refresh)
FcmBridgeManager.SetTokenRefreshListener(token =>
{
    Console.WriteLine($"New FCM token: {token}");
    // Send token to your server
});

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

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

// Subscribe to a topic
var sub = await FcmBridgeManager.SubscribeToTopicAsync("news");
if (!sub.Success)
    Console.WriteLine($"Subscribe failed: {sub.Message}");

// Unsubscribe from a topic
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