Azure 通知中心格式标记负载 REST API
Azure Notifications hub format tags payload REST API
我有一个连接到数据库的普通 C# MVC 网站,我正在存储我的 phone 应用推送 ID。
我使用这些推送 ID 并想向其发送推送。
我可以使用 Microsoft Azure 网站上的发送测试推送功能手动执行此操作,方法是将值插入那里的标签字段。
但现在我想用我网站上的 REST API 来完成。
我在 .NET 示例中遵循了这个
https://github.com/Azure/azure-notificationhubs-samples
Android 的有效负载如下所示:
{\"data\":{\"message\":\"" + message + "\"}}
我尝试通过这样做将标签添加到负载中:
{\"data\":{\"message\":\"" + message + "\"}, \"tags\":{\"DeviceToken\":\"the push ID here\"}}
但是没有用。推送已发送给所有人。
如何使用或格式化 REST 中的标签 API?
解法:
headers.Add("ServiceBusNotification-Tags", recipient);
我的收件人是安装 ID
根据您的描述,我检查了REST API Send a GCM Native Notification and followed azure-notificationhubs-samples来测试这个问题。为了向您的负载添加标签,您可以指定 ServiceBusNotification-Tags
header。我给一组标签(游戏,新闻)发送了一个GCM原生通知,你可以参考一下:
此外,您可以利用 Microsoft.Azure.NotificationHubs for sending push notifications. For more details, you could refer to this official document。
我有一个连接到数据库的普通 C# MVC 网站,我正在存储我的 phone 应用推送 ID。
我使用这些推送 ID 并想向其发送推送。 我可以使用 Microsoft Azure 网站上的发送测试推送功能手动执行此操作,方法是将值插入那里的标签字段。
但现在我想用我网站上的 REST API 来完成。
我在 .NET 示例中遵循了这个
https://github.com/Azure/azure-notificationhubs-samples
Android 的有效负载如下所示:
{\"data\":{\"message\":\"" + message + "\"}}
我尝试通过这样做将标签添加到负载中:
{\"data\":{\"message\":\"" + message + "\"}, \"tags\":{\"DeviceToken\":\"the push ID here\"}}
但是没有用。推送已发送给所有人。
如何使用或格式化 REST 中的标签 API?
解法:
headers.Add("ServiceBusNotification-Tags", recipient);
我的收件人是安装 ID
根据您的描述,我检查了REST API Send a GCM Native Notification and followed azure-notificationhubs-samples来测试这个问题。为了向您的负载添加标签,您可以指定 ServiceBusNotification-Tags
header。我给一组标签(游戏,新闻)发送了一个GCM原生通知,你可以参考一下:
此外,您可以利用 Microsoft.Azure.NotificationHubs for sending push notifications. For more details, you could refer to this official document。