[英]Adding push notification tags to Azure Notification Hub after device registration
We are using Azure Notification Hub for push notifications to our app. 我们正在使用Azure Notification Hub将推送通知推送到我们的应用程序。 All works really well and we can send push notifications to both Android and iOS devices. 一切都运行良好,我们可以将推送通知发送到Android和iOS设备。
We would like to start using tags when sending push notifications to target specific groups of our user base. 在将推送通知发送到特定的用户群时,我们希望开始使用标签。 We want to add new tags in the future. 我们希望将来添加新标签。
In all the code examples I see, the tags are registered during the device registration process. 在我看到的所有代码示例中,标签是在设备注册过程中注册的。 Can you add tags completely separately to the device registration process? 您可以在设备注册过程中完全单独添加标签吗? Or do we have to re-register the device each time we want to roll out new tags? 还是我们每次要推出新标签时都必须重新注册设备?
This link example seems to be solving the same problem you have: 该链接示例似乎正在解决您遇到的相同问题:
var registrations = await hub.GetRegistrationsByTagAsync("{userId}", 10);
foreach (var reg in registrations)
{
reg.Tags.Add("{newBand}");
await hub.UpdateRegistrationAsync(reg);
}
The example gets previous registrations using a Tag although you should be able to search by registrationId as well. 该示例使用Tag获取先前的注册,尽管您也应该能够通过registrationId进行搜索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.