Firebase Cloud Messaging (FCM) push notification support for .NET MAUI applications on iOS and Android, built on the Shiny framework.
- Firebase Cloud Messaging for iOS and Android
- Embedded configuration via
GoogleService-Info.plist/google-services.json - Manual configuration support
- Topic subscription support (iOS)
- Custom push delegate for handling notification events
- Native iOS Firebase SDK 12.x via Slim Bindings
dotnet add package Shiny.Push.FirebaseMessagingusing Shiny;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseShiny();
// Use embedded configuration (GoogleService-Info.plist / google-services.json)
builder.Services.AddPushFirebaseMessaging();
// OR manual configuration
builder.Services.AddPushFirebaseMessaging(new FirebaseConfiguration(
UseEmbeddedConfiguration: false,
AppId: "your-app-id",
SenderId: "your-sender-id",
ProjectId: "your-project-id",
ApiKey: "your-api-key"
));
// With a custom push delegate
builder.Services.AddPushFirebaseMessaging<MyPushDelegate>();
return builder.Build();
}
}- Download
GoogleService-Info.plistfrom the Firebase Console - Add to your iOS project with Build Action set to
BundleResource - Enable Push Notifications capability in Entitlements.plist
- Enable Remote Notifications background mode
- Download
google-services.jsonfrom the Firebase Console - Add to your Android project root
| Parameter | Type | Default | Description |
|---|---|---|---|
UseEmbeddedConfiguration |
bool |
true |
Use platform config files |
AppId |
string? |
null |
Firebase App ID |
SenderId |
string? |
null |
Firebase Sender ID |
ProjectId |
string? |
null |
Firebase Project ID |
ApiKey |
string? |
null |
Firebase API Key |
DefaultChannel |
NotificationChannel? |
null |
Android only - default notification channel |
IntentAction |
string? |
null |
Android only - custom intent action |
The iOS implementation supports FCM topic subscriptions through IPushTagSupport:
if (push is IPushTagSupport tagSupport)
{
await tagSupport.AddTag("news");
await tagSupport.RemoveTag("promotions");
await tagSupport.SetTags("news", "updates");
await tagSupport.ClearTags();
}MIT