Azure移动服务向特定IOS用户发送推送通知
本文关键字:用户 通知 IOS 移动 服务 Azure | 更新日期: 2024-09-21 19:09:00
我可以向所有具有以下代码的设备发送推送通知
ApplePushMessage message = new ApplePushMessage("Item : "+ item.Name+ " Saved", System.TimeSpan.FromHours(1));
try
{
var result = await Services.Push.SendAsync(message);
Services.Log.Info(result.State.ToString());
}
catch (System.Exception ex)
{
Services.Log.Error(ex.Message, null, "Push.SendAsync Error");
}
我需要使用设备令牌发送给特定用户。
我用node.js找到了代码。但是用.net我不能只发送给特定的用户。
// Get the ID of the logged-in user.
var userId = user.userId;
function insert(item, user, request) {
request.execute();
setTimeout(function() {
push.apns.send(userId, {
alert: "Alert: " + item.text,
payload: {
"Hey, a new item arrived: '" + item.text + "'"
}
});
}, 2500);
}
Dotnet中是否有等效的代码方法。或者我可以使用用户标签而不是设备令牌吗?
提前感谢。
是的,我认为标记是更好的方法。我们使用它,而且效果很好。
https://msdn.microsoft.com/en-us/library/azure/dn530749.aspx-引导
https://msdn.microsoft.com/en-us/library/azure/dn530749.aspx?cs-保存lang=1&cslang=csharp#code-snippet-3-一些代码。
如果这是一个有用的答案,请将其标记为有用或答案。谢谢