一键导入
shiny-firebase
Guide for implementing Firebase Cloud Messaging push notifications in .NET MAUI apps using Shiny.Push.FirebaseMessaging on iOS and Android.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for implementing Firebase Cloud Messaging push notifications in .NET MAUI apps using Shiny.Push.FirebaseMessaging on iOS and Android.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate code using Shiny.DocumentDb.Firestore.Mobile, an on-device (native) Firebase Firestore provider for Shiny.DocumentDb on iOS and Android — offline-first persistence, real-time snapshot listeners, LINQ queries, and managed Firebase Auth identity.
Generate code using Shiny.Extensions.Push, a server-side push notification dispatch library for .NET with a provider-agnostic core and transports for APNs (.p8/ES256), FCM (HTTP v1), Web Push (VAPID + RFC 8291) and WNS (Windows App SDK / Entra auth), plus Shiny.DocumentDb persistence, structured targeting, topics, interceptors, dead-token pruning, multi-app keyed registration, runtime static/dynamic (multi-tenant) configuration via IPushConfigurationProvider, and System.Diagnostics.Metrics + tracing — fully AOT/trim-safe.
Generate code using Shiny.Speech for cross-platform speech-to-text, text-to-speech, audio capture, and audio playback with pluggable cloud providers
Shiny BluetoothLE client/central operations for scanning, connecting, and communicating with BLE peripherals
Generate code for Shiny.AiConversation - a centralized AI service library for .NET MAUI apps with chat client abstraction, wake word detection, speech-to-text/text-to-speech, acknowledgement modes (None/AudioBlip/LessWordy/Full), persistent message store, optional AI chat history lookup tool, and configurable sound effects
Generate code using Shiny Aspire integrations — Orleans ADO.NET hosting and Gluetun VPN container routing
| 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.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.
Shiny.Push.FirebaseMessaging
using Shiny;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseShiny(); // Required
// Option 1: Use embedded configuration (GoogleService-Info.plist / google-services.json)
builder.Services.AddPushFirebaseMessaging();
// Option 2: Use embedded configuration explicitly
builder.Services.AddPushFirebaseMessaging(FirebaseConfiguration.Embedded);
// Option 3: 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();
}
}
public class MyPushDelegate : IPushDelegate
{
public Task OnReceived(PushNotification notification)
{
// Handle incoming push notification
return Task.CompletedTask;
}
public Task OnNewToken(string token)
{
// Handle FCM token changes - send to your backend
return Task.CompletedTask;
}
public Task OnUnRegistered(string token)
{
// Handle when the device is unregistered from push
return Task.CompletedTask;
}
public Task OnEntry(PushNotification notification)
{
// Handle when user taps on a notification
return Task.CompletedTask;
}
}
| 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 |
GoogleService-Info.plist to your iOS project (if using embedded configuration)BundleResourcegoogle-services.json to your Android project root (if using embedded configuration)The iOS implementation supports topic subscriptions through IPushTagSupport:
// Inject IPushManager
var push = services.GetRequiredService<IPushManager>();
// Cast provider to access tag support
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;
}
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.
src/Shiny.Push.FirebaseMessaging/FirebaseConfiguration.cs - Configuration recordsrc/Shiny.Push.FirebaseMessaging/Platforms/Shared/ServiceCollectionExtensions.cs - DI registrationsrc/Shiny.Push.FirebaseMessaging/Platforms/iOS/FirebasePushProvider.cs - iOS FCM provider