【发布时间】:2017-10-27 14:06:58
【问题描述】:
我正在从我的 .NET 后端服务器代码注册安装,每个都有多个模板。例如:
var installation = new Installation
{
InstallationId = id,
PushChannel = token,
Templates = new Dictionary<string, InstallationTemplate>(),
Tags = new List<string> { "userId:123456" },
Platform = NotificationPlatform.Gcm
};
installation.Templates.Add("template1", new InstallationTemplate { Body = "{\"data\":{\"message\":\"$(message)\"}}"});
installation.Templates.Add("template2", new InstallationTemplate { Body = "{\"data\":{\"message2\":\"$(message)\"}}"});
await _client.CreateOrUpdateInstallationAsync(installation);
发送通知时如何定位特定模板?我在 SDK 中看到的内容如下:
await _client.SendTemplateNotificationAsync(
new Dictionary<string, string>
{
{ "message", "Hello world." }
}, "userId:123456");
SendTemplateNotificationAsync 方法没有任何参数可以让我指定目标模板(例如,template2)。
将使用哪个模板?我是不是误会了什么?
【问题讨论】:
标签: c# .net azure azure-notificationhub