MicrosoftDocs/azure-docs

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.

@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 the X-WNS-Type header setup, then it throws 400 error asking us to add the header.
  • If the payload has launch parameter, and has X-WNS-Type header set to wns/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.