I am using the azure notification hub in asp.net core to send toast notifications to an UWP app. Where can I set the toast notification tag (not the registration tag) in order to update later the notification?
Send the notification:
var payload = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<toast>\r\n<visual><binding template=\"ToastText01\">\r\n<text id=\"1\">Test message</text>\r\n</binding>\r\n</visual>\r\n</toast>\r\n";
var azureNotificationHub = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://XXXX.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=XXXXX=", "XXXX");
await azureNotificationHub.SendWindowsNativeNotificationAsync(payload, new List<string> { token });
Register to the azure notification hub:
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var id = Windows.System.Profile.SystemIdentification.GetSystemIdForPublisher();
var deviceID = RetrieveStringFromUtf8IBuffer(id.Id);
var hub = new NotificationHub("XXXX", "Endpoint=sb://XXXX.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=XXXX=");
var result = await hub.RegisterNativeAsync(channel.Uri, new List<string> { deviceID });
When I now want to update or remove the notification, I cannot do it because the notification tag is empty:
ToastNotificationManager.History.Remove(tag: ???);
How can I provide the tag as a primary key for the toast notification?
In addition is it possible to group toast notifications with a azure notification hub?