0
votes

I'm new to Windows Phone development and very new to push notifications.

I'm developing a application for my client which uses the Azure Mobile Services push notification. I read THIS blog and added following code in my App.xaml at the top of the Application_Launching method.

var channel = HttpNotificationChannel.Find("MyPushChannel");
if (channel == null)
{
    channel = new HttpNotificationChannel("MyPushChannel");
    channel.Open();
    channel.BindToShellToast();
}

channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(async (o, args) =>
{
    var hub = new NotificationHub("<hub name>", "<connection string>");
    await hub.RegisterNativeAsync(args.ChannelUri.ToString());
});

For the channel name I'm using Device Token. For hub name and connection string I've to ask my client.

But still I'm confuse that how it will get the notification? What are the next steps to receive the notifications? I want to receive the notifications when the app is running in front and back.

Also, I have to navigate to different-2 screens using these notifications.

Please help me.

UPDATE:

  1. I have a Azure Mobile Service provided by the client.
  2. I have the hub and it's connection string.
  3. I wan to receive raw push notifications in my Windows Phone 8.1 silverlight app.

UPDATE

Created a new demo Windows Mobile 8.1 Silverlight app and tried THIS. It worked perfectly. I'm getting the raw notifications in this demo app.

Now I want to know how can I connect it with my client's API i.e. Azure Mobile Service / Hub? Or there is no need to setup a connection between the created channel and AMS/Hub?

In last two days I read a lot on the internet but there is no solution for my problem. Please help me.

Thanks

Kapil

1

1 Answers

1
votes

https://msdn.microsoft.com/en-us/library/windows/apps/jj679948.aspx

This is what you need to work with Push notifications in your windows phone 8.1 application