ToastTemplate with launch not sending notification to UWP application(Windows 10)
Closed this issue · 5 comments
[Enter feedback here]
When I pass launch parameter with the sample Windows store toast payload, the notification is not received in my UWP application.
My payload:
<toast launch="15"><visual><binding template=\"ToastText01\"><text id=\"1\">Hello from Java!</text></binding></visual></toast>
It works if I test it in the portal, but not when I send it from my server.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: d6d92634-7ce2-75f7-6de2-945bb19ee5f4
- Version Independent ID: fbaa9e41-5be3-9e64-a4fc-b2ef60d7f29f
- Content: How to use Azure Notification Hubs with Java
- Content Source: articles/notification-hubs/notification-hubs-java-push-notification-tutorial.md
- Service: notification-hubs
- GitHub Login: @sethmanheim
- Microsoft Alias: sethm
@Druffl3 - Thanks for brining this to our attention. We will investigate it further and update you shortly.
Hi @Druffl3, some clarification. When you say
the sample Windows store toast payload
are you referring to sending your <toast />
and receiving it Notification Visualizer?
Also, you indicate it doesn't work when you send it from your server, is this is an on-prem server? How did you configure you server to send the notifications?
Thanks for responding @RyanHill-MSFT
the sample Windows store toast payload
are you referring to sending your
<toast />
and receiving it Notification Visualizer?
No, not Notification Visualizer, I am using the testing portal available in Azure and also this protal, to send a toast notification to my application. And it works just fine- the UWP application displays the toast notification and on tap of it, I am able to capture the arguments passed in launch
.
Also, you indicate it doesn't work when you send it from your server, is this is an on-prem server? How did you configure you server to send the notifications?
Yes, it is an on premise server. And this is what we are doing in Java:
String toastMsg = "<toast launch=\"15.1\"><visual><binding template=\"ToastGeneric\"><text id=\"1\">Sample test message</text></binding></visual></toast>";
NotificationHub hub = new NotificationHub(CONNECTION_URL,HUBPATH);
Map<String, String> map = new HashMap<String, String>();
map.put("X-WNS-Type", "wns/toast");
map.put("X-WNS-RequestForStatus", "true");
Notification n = Notification.createWindowsNotification(toastMsg);
n.setContentType(ContentType.TEXT_XML);
n.setHeaders(map);
NotificationOutcome outcome=hub.sendNotification(n, wwid);
System.out.println("Notification generic : "+outcome.getTrackingId());
And these are the observed scenarios:
- If the payload doesn't have
launch
parameter then, notification is displayed in the UWP application. - If the payload has
launch
parameter but doesn't have theX-WNS-Type
header setup, then it throws400 error
asking us to add the header. - If the payload has
launch
parameter, and hasX-WNS-Type
header set towns/toast
, then there is no error received on the server side and no notification is displayed in the UWP application.
Are we missing anything here? I repeat, we don't face any issue when we send the same toast notification with launch parameter from either of the testing portals.(Azure and Test)
There was a configuration fault from the server side. I am proceeding to close this issue. 😅
No problem @Druffl3, glad you were able to sort it out. I would like to add however that for
If the payload has launch parameter but doesn't have the X-WNS-Type header setup, then it throws 400 error asking us to add the header.
was determined to be a bug in the Java SDK that's currently being track. The missing X-WNS-Type
should be inferred by the SDK and add it behind the scenes. This will addressed in a future update.