使用按钮发送天蓝色推送通知

问题描述

我正在尝试使用 azure 通知中心中的按钮发送推送通知。我刚刚为 iOS 找到了这个示例,

https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-aspnet-backend-ios-apple-push-notification-service-apns-rich

有没有办法添加一个按钮来向 Xamarin 表单添加 azure 推送通知

解决方法

是的,这是可能的。

有关如何执行此操作的文档位于此处:https://docs.microsoft.com/en-us/azure/developer/mobile-apps/notification-hubs-backend-service-xamarin-forms

编辑:

要获得取消按钮,您需要定义解除操作:

var categoryID = "message";
var actions = new UNNotificationAction [] { action };
var intentIDs = new string [] { };
var categoryOptions = new UNNotificationCategoryOptions [] { };
var category = UNNotificationCategory.FromIdentifier (categoryID,actions,intentIDs,UNNotificationCategoryOptions.CustomDismissAction);

见:https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/enhanced-user-notifications?tabs=windows