| name | shiny-firebase |
| description | Guide for implementing Firebase Cloud Messaging push notifications in .NET MAUI apps using Shiny.Push.FirebaseMessaging on iOS and Android. |
| auto_invoke | true |
| triggers | ["firebase","FCM","firebase cloud messaging","push notifications firebase","AddPushFirebaseMessaging","FirebaseConfiguration","GoogleService-Info.plist","google-services.json","firebase push","firebase messaging"] |
Shiny Firebase Push Notifications Skill
Overview
Shiny.Push.FirebaseMessaging provides Firebase Cloud Messaging (FCM) push notification support for .NET MAUI applications on iOS and Android. It wraps the native Firebase iOS SDK (via Slim Bindings) and Android FCM through the Shiny Push infrastructure.
NuGet Package
Shiny.Push.FirebaseMessaging
Setup
MauiProgram.cs Configuration
using Shiny;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseShiny();
builder.Services.AddPushFirebaseMessaging();
builder.Services.AddPushFirebaseMessaging(FirebaseConfiguration.Embedded);
builder.Services.AddPushFirebaseMessaging(new FirebaseConfiguration(
UseEmbeddedConfiguration: false,
AppId: "your-app-id",
SenderId: "your-sender-id",
ProjectId: "your-project-id",
ApiKey: "your-api-key"
));
builder.Services.AddPushFirebaseMessaging<MyPushDelegate>();
return builder.Build();
}
}
Custom Push Delegate
public class MyPushDelegate : IPushDelegate
{
public Task OnReceived(PushNotification notification)
{
return Task.CompletedTask;
}
public Task OnNewToken(string token)
{
return Task.CompletedTask;
}
public Task OnUnRegistered(string token)
{
return Task.CompletedTask;
}
public Task OnEntry(PushNotification notification)
{
return Task.CompletedTask;
}
}
FirebaseConfiguration Record
| Parameter | Type | Default | Description |
|---|
UseEmbeddedConfiguration | bool | true | Use platform config files (GoogleService-Info.plist / google-services.json) |
AppId | string? | null | Firebase App ID (required if not using embedded config) |
SenderId | string? | null | Firebase Sender ID (required if not using embedded config) |
ProjectId | string? | null | Firebase Project ID (required if not using embedded config) |
ApiKey | string? | null | Firebase API Key (required if not using embedded config) |
DefaultChannel | NotificationChannel? | null | Android only - default notification channel |
IntentAction | string? | null | Android only - custom intent action |
Platform-Specific Requirements
iOS
- Add
GoogleService-Info.plist to your iOS project (if using embedded configuration)
- Set Build Action to
BundleResource
- Enable Push Notifications capability in Entitlements.plist
- Enable Remote Notifications background mode
Android
- Add
google-services.json to your Android project root (if using embedded configuration)
- The Shiny Push library handles the Android Firebase initialization automatically
Topic Subscriptions (Tags)
The iOS implementation supports topic subscriptions through IPushTagSupport:
var push = services.GetRequiredService<IPushManager>();
if (push is IPushTagSupport tagSupport)
{
await tagSupport.AddTag("news");
await tagSupport.RemoveTag("promotions");
await tagSupport.SetTags("news", "updates");
await tagSupport.ClearTags();
var currentTags = tagSupport.RegisteredTags;
}
Extension Methods
AddPushFirebaseMessaging(FirebaseConfiguration? config = null)
Registers Firebase push notification services. Pass null or omit for embedded configuration.
AddPushFirebaseMessaging<TPushDelegate>(FirebaseConfiguration? config = null)
Registers Firebase push with a custom IPushDelegate implementation that handles notification events.
Key Source Files
src/Shiny.Push.FirebaseMessaging/FirebaseConfiguration.cs - Configuration record
src/Shiny.Push.FirebaseMessaging/Platforms/Shared/ServiceCollectionExtensions.cs - DI registration
src/Shiny.Push.FirebaseMessaging/Platforms/iOS/FirebasePushProvider.cs - iOS FCM provider