0

Followed the "Get started with Notification Hubs" walk through line by line and verified that I've done everything correctly. From what I can see. But, I get no notification message in to Windows Store app.

The code runs, no errors. I can see the registration appears on the NH dashboard as the charts show the operation.

But nothing happens.

How do I troubleshoot this?

        //register yourself with WNS and tell it you are ready to receive Push Notifications
        var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

        //connect to service bus
        var cn = ConnectionString.CreateUsingSharedAccessKey(new Uri("sb://<namespace>.servicebus.windows.net"),
            "<sharedaccesskeyname>", "<sharedaccesskey>");

        //connect to Notification Hub
        NotificationHub hub = new NotificationHub("<hub name>", cn);

        //Send the channel.Uri from WNS to Notification Hubs
        await hub.RegisterNativeAsync(channel.Uri);

and then the back-end code is a simple Console app that does this;

        var client = NotificationHubClient.CreateClientFromConnectionString(
            "Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=<sharedkeyname>;SharedAccessKey=<sharedaccesskey>",
            "<hub name>");

        //send a message through NH
        await client.SendWindowsNativeNotificationAsync(String.Format("<toast><visual><binding template=\"ToastText01\"><text id=\"1\">{0}</text></binding></visual></toast>", 
            "Hello!"));
ryancrawcour
  • 676
  • 8
  • 18

1 Answers1

1

Debugging push notifications can be tricky (we are working to improve the debug experience). There is really not enough information to help you but I will provide some pointers, and feel free to reach out for me if you are still blocked. I will refer to the Get Started tutorial on Windowsazure.com (http://www.windowsazure.com/en-us/manage/services/notification-hubs/getting-started-windows-dotnet/).

Some pointers:

  1. Look at the dashboard for:

    • incoming messages (if you do not have any, then you are either sending to the wrong hub, or you are not )
    • successful notifications (if you see these then your client app is not able to show a toast, either check the xml or make sure that in the manifest you enabled toast, second step of tutorial section "Send notifications from your back-end")
    • WNS Authentication errors (verify your PackageSID and Client secret in the Configure tab of your notification hub)
    • Invalid channel errors (make sure you associated your client app code with your windows store app, step 4 of section "Register your app with Windows Store" in the tutorial)
  2. Try enabling the EnableTestSend property on NotificationHubClient (http://msdn.microsoft.com/en-us/library/microsoft.servicebus.notifications.notificationhubclient.enabletestsend.aspx). This will have your send method return the list of the registrations that were targeted with your notification and the individual results. If you see no registrations being targeted by your notification then you are either not registering correctly or you are sending and/or registering to the mismatched tags. Important: do not use test send in production, as it will only broadcast to 5 devices and it is heavily throttled.

Elio Damaggio
  • 862
  • 4
  • 6
  • some good pointers here. thanks. the only counter I see ticking up is the registration. don't ever see anything ticking up in the incoming messages. – ryancrawcour Sep 24 '13 at 03:59
  • If that is the case, make sure that: – Elio Damaggio Sep 25 '13 at 17:47
  • 1) you are sending to the correct hub, and 2) that the console app is not exiting before the async calls returns (make sure you can read the SendResult instance with the debugger or see an exception) – Elio Damaggio Sep 25 '13 at 18:08