【发布时间】:2018-04-16 02:53:22
【问题描述】:
我在 .Net Core 项目中使用 Azure 通知中心的预览版。在我们的服务器上,我让它为通知中心安装设备。我可以设法将设备安装到后端的通知中心,并能够通过门户向 iOS 设备发送测试。
我尝试在后端代码中添加一行
[HttpPost]
[Route("TestMessage")]
public async Task<IActionResult> NotifyByTemplate([FromBody] ApiAttendanceModel model)
{
//string jsonMessage, IDictionary<string, string> additionalProperperties, string tagExpressions
var additionalProperties = new Dictionary<string, string>();
additionalProperties.Add(Constants.Constant.NotificationMsgName, "asdf");
var hub = NotificationHubClient.CreateClientFromConnectionString(Constants.Constant.NotificationConnectionString, Constants.Constant.NotificationHubName);
var result = hub.SendAppleNativeNotificationAsync("{'aps':{ 'alert':'Notification hub test notification' }}");//await hub.SendTemplateNotificationAsync(additionalProperties);
return Ok(true);
}
我什至使用了 hub.SendTemplateNotificationAsync。没有通知进来。
我想知道推送通知的预览版工作是否适用于 .net Core。
【问题讨论】:
标签: azure push-notification notifications .net-core