用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill maui-push-notifications命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | maui-push-notifications |
| description | > Use when this capability is needed. |
| Issue | Cause | Fix |
|---|---|---|
| Token changes every debug run (Android) | Debug builds regenerate Firebase tokens | Always re-register in OnNewToken |
HttpClient requests fail silently | BaseAddress missing trailing / | Ensure endpoint ends with / |
| iOS push won't arrive on simulator | Simulators don't support APNS | Use a physical iOS device |
| No notifications on Android 13+ | POST_NOTIFICATIONS required (API 33+) | Call RequestPermissions in OnCreate |
| Notification channel missing (API 26+) | Android requires explicit channel creation | Create channel before sending |
SendNotificationAsync throws for >20 tags | Azure NH tag expression limit | Batch tags in groups of 20 |
422 on device registration | Platform string mismatch | Use "fcmv1" (not "gcm") and "apns" |
Token empty at RegisterAsync | Race condition on cold start | Guard with IsNullOrWhiteSpace check |
HttpClient.BaseAddress must end with /. Without it, relative URI resolution silently breaks.
// ❌ Relative URIs resolve incorrectly
_http = new HttpClient { BaseAddress = new Uri("https://example.com") };
// ✅ Trailing slash required
_http = new HttpClient { BaseAddress = new Uri("https://example.com/") };
Firebase tokens regenerate frequently in debug builds. If you skip OnNewToken, the backend holds a stale token and pushes silently fail.
// ❌ Only registering once at startup
// (token may change later without re-registration)
// ✅ Always re-register in OnNewToken
public override void OnNewToken(string token)
{
var svc = IPlatformApplication.Current?.Services.GetService<IPushNotificationService>();
if (svc is null) return;
svc.Token = token;
_ = svc.RegisterAsync();
}
Without explicitly requesting POST_NOTIFICATIONS on API 33+, notifications are silently dropped.
SendNotificationAsync throws if a tag expression references more than 20 tags. Batch into chunks:
// ✅ Batch tags to stay under the limit
var batches = request.Tags.Chunk(20);
foreach (var batch in batches)
{
var tagExpr = string.Join(" || ", batch);
await _hub.SendFcmV1NativeNotificationAsync(payload, tagExpr, ct);
}
The legacy "gcm" platform string causes 422 errors on device registration. Always use "fcmv1" for Android and "apns" for iOS.
APNS only works on physical iOS devices. Simulators silently ignore push registrations.
google-services.json in Platforms/Android/ with <GoogleServicesJson> in .csprojXamarin.Firebase.Messaging NuGet package added (Android-only condition)POST_NOTIFICATIONS permission requested on API 33+OnNewToken always calls RegisterAsyncFirebaseMessagingService registered in manifest with MESSAGING_EVENT intent filter.p8) uploaded to Azure Notification HubEntitlements.plist with aps-environment set to development or productionCodesignEntitlements set in .csprojRegisterForRemoteNotifications called on main thread after authorization grantBaseAddress ends with trailing /"fcmv1" and "apns" (not legacy values)MAUI app → ASP.NET Core backend → Azure Notification Hub → FCM / APNS → device
See references/push-notifications-api.md for full implementation templates.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.