So I'm trying to get the push notifications working with Azure and windows phone 8 but I get a Unsupported channel uri: 'http://s.notify....' exception. We got it working with android and ios but I have a problem with windows phone. So on the windows phone where doing first the call's like the code below. This gives me a Uri that looks like this:
The way I got this code is with this code:
HttpNotificationChannel pushChannel;
// Try to find the push channel.
pushChannel = HttpNotificationChannel.Find(App.HubName);
// If the channel was not found, then create a new connection to the push service.
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(App.HubName, App.ServiceName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive the notifications while your application is running.
pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
pushChannel.Open();
// Bind this new channel for Tile events.
pushChannel.BindToShellToast();
}
else
{
// The channel was already open, so just register for all the events.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive the notifications while your application is running.
pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);
// Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString());
MessageBox.Show(String.Format("Channel Uri is {0}", pushChannel.ChannelUri.ToString()));
}
After that I send the pushChannel.ChannelUri to the server to create a backend registration of my device. The error (Unsupported channel uri) appears at the call:
var registrationDescription = await _hub.CreateOrUpdateRegistrationAsync(registration);
The registration comes from:
RegistrationDescription registration = new WindowsTemplateRegistrationDescription(request.Handle, request.Template);
The Handle is the request Uri I send to the server and the template is the xml template.
Now I don't know whats going wrong and am becoming a little bit crazy because of this error. Especially since the code works for android and ios but not for the wp8. I also tried with the PushNotificationChannelManager but it just crashes when it's doing the CreatePushNotificationChannelForApplicationAsync call.
Thanks in advance