Unable to receive WNS notification if push with Notification-Hubs-java-sdk-1.0.3.jar
Hi,
I'm trying to push WNS notification with Notification-Hubs-java-sdk-1.0.3.jar, but it doesn't work.
Is there any ways to resolve it? Thanks.
https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-windows-store-dotnet-get-started-wns-push-notification
https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-java-push-notification-tutorial
https://github.com/Azure/azure-notificationhubs-java-backend
https://search.maven.org/artifact/com.windowsazure/Notification-Hubs-java-sdk
According the descriptions above, I created
an UWP app for receiving WNS notification and a JAVA console for pushing WNS notification.
When I use Notification-Hubs-java-sdk-1.0.3.jar,
hub.sendNotification() returned sucessfully, but the UWP app didn't receive it.
TrackingId: 86726822-6575-4594-a572-d782d698600c
When I use Notification-Hubs-java-sdk-0.4.2.jar,
hub.sendNotification() returned sucessfully, and the UWP app received it.
TrackingId: 240008fe-3beb-4a63-855e-3096735c9032
I checked Metrics Chart on https://portal.azure.com/, Incoming Messages (Sum) increased both 1.0.3 and 0.4.2.
So I think Notification-Hubs got the WNS notification of 1.0.3.
This is the code of JAVA console:
import com.windowsazure.messaging.*;
public class WNSSender {
public static void main(String args[]) {
System.out.println("WNSSender Start");
try {
String connectionString = "Endpoint=sb://...";
String hubPath = "...";
NotificationHub hub = new NotificationHub(connectionString, hubPath);
String toast = "<toast><visual><binding template=\"ToastText01\"><text id=\"1\">Hello from Java Test!</text></binding></visual></toast>";
System.out.println(toast);
Notification n = Notification.createWindowsNotification(toast);
NotificationOutcome outcome = hub.sendNotification(n);
System.out.println("WNSSender End " + outcome.getNotificationId() + " " + outcome.getTrackingId());
} catch (Exception e) {
e.printStackTrace();
}
}
}