Posts Tagged ‘Push Notification’

The Windows Azure Service Bus Notification Hub is finally released and it is generally available to be used in the development. It supports multiple platform push notification like Google, Microsoft and apple push notification. The Notification Hub will easily help the application to reach millions of users through their mobile or windows application by simply sending them a Notification through the Service Bus.

Here are the differences between the Windows Azure Mobile Services and the Notification Hub push notification. This table is taken from Announcing General Availability of Windows Azure Notification Hubs & Support for SQL Server AlwaysOn Availability Group Listeners

Mobile Services

Notification Hubs

MPNS, WNS, APNS, and GCM support



Turnkey event-triggered push



Device registration management



Interest tags for routing messages to a subset of users



Templates for formatting messages to user preferences including language



Broadcast to >1 million devices at once within minutes



After a while of putting Node JS on Windows Azure, and the people start working with it plus the great advantages Node JS is offering to the clients and its great performance and some advantages over the web API. Windows Azure is now offering Windows Azure mobile services that will help the developers build applications for different platforms with a very easy way to store, push notification and even provide identity with the integration with several identity providers like Hotmail, Google, Amazon and others.

So how to create a Windows Azure mobile service?

There are few several steps to be done to create your Windows Azure Mobile service through the Windows Azure portal.

After signing in to the Windows Azure portal, just click on the button “New”, select “Compute” then “Mobile Service” and finally on “Create”.

A new window will be prompted and you will be asked to enter a valid URL for the Mobile Services, choose whether you want to create a new SQL database or connect to an existing one and the location you want to host your mobile services in.

After you click on next, you will be asked for the username and the password for the database. You will have to enter the required credentials and after that you will see the Mobile services is being created.

Now let’s dig a bit more in the Mobile service. When the Windows Azure finishes creating the mobile services, click on it and the following page will open.

This page offers you all what you can do with the Windows Azure mobile services. The first one, the button that has a look of a cloud and a thunder in it will bring to this page, where you can choose the platform you want your mobile service to connect to it. you can see a lot of different platform you can connect to them using the Mobile services. In the Get Started you will have 2 options whether you can download a full application for the required platform so you can build application for it or it can helps you to connect to an application that you have already started developing it.

The next button which is the Dashboard, it gives you a small monitoring on the mobile services with statistics, certainly with all the required information about the Mobile services, the location, its URL and so on.

The Data button is the one responsible for the data you entered in the Windows Azure mobile services. You can create several tables as much as you need, all these tables are automatically created in the database related. One of the best things in the Mobile Services is that the table created has dynamic columns which means that you can add new fields in the table as much as you need whenever you want. You will not have to create these columns on the table creation but depending on your application demands.

Lately Windows Azure Mobile services has started to support different Node JS NPM so you rather than just building mobile application with some limited functionalities now it gives you the opportunity to develop and do more using the NPM that you can add to the Mobile service. To develop on Windows Azure Mobile Service and use the NPM in your development you should create a new API found under the third button.

You also can schedule some work to be done from time to time using the Windows Azure Scheduler found in the fourth button, however this feature is still in preview, as the scaling one too.

The next one which is the Push, is the one related to the push notification. This is compatible with different platforms whether Microsoft Technologies (Windows 8 or Windows Phone) and non Microsoft Android and Apple. You can find a small introduction on Windows Azure push notification in a previous blog post and this one in the Mobile Portal is the new evolution of it. There is also the Windows Azure Service Bus Notification hub.

The next feature is the Identity, this one will allow you to integrate your application with different identity provider whether they are Microsoft or others. This feature will also require that you get some information about your application from your application that you developed on this platform most probably you will find them in the administration on the marketplace.

The last one I am going to explain now is the “configure” this one where has the main details about your database and server. The main thing that I want to show now is the CORS or the cross origin resource sharing, this is where you will be asked to enter the URL that will be allowed to deal with your application. PS if you develop cloud application and you want to test them on the local machine and this application is integrating with the mobile service you will have to enter the URL of your machine.

You can find the tutorials that can help you to get started here.

A very great integration I think you can offer you application while developing Windows Azure Mobile services using the NPM is also using the SignalR for better interaction between the client and the server and create better real time application

Here you can find all the details for the updates done on the mobile services and how you can start adding the NPM to your solution.

In the following link you can find the Windows Azure SDK for the Windows Azure development using Node JS.

Like the push notification on Windows Phone 7, there is also another type of notifications that you can do using the Service Bus. There are several ways to do so, for nowadays, there are a new way that facilitate much more the development and the subscription of the devices to the Service Bus. This kind of Service Bus is called the Service Bus Notification Hub, like the Service Bus Relay Messaging and the Service Bus Brokered Messaging, there are some steps that you should do to create the required Service Bus Notification Hub. This feature is still in Preview.

Here are the steps:

You have to download special references for the development for the Push Notification hub. After creating your project on Visual Studio, go to tools -> Library Package Manager -> Package Manager Console and enter the following command:

Install-Package ServiceBus.Preview

Going to the portal:

First of all, go to you Windows Azure Portal and quick Create a notification hub as shown below

After creating the service bus, there are several few things that must be done to register in the service bus.

Here they are in brief I will explain each one of them later on.

  1. Download the required ServiceBus.Preview.dll from the NuGet, previously explained.
  2. Create a Windows Store application using Visual Studio
  3. Get the Package SID & Client Secret from after registering the application in the store and paste it in the Notification Hub Configuration
  4. Associate the application created on Visual Studio with the one created on the store.
  5. Get the Connection information from the Notification hub.
  6. Enable the Toast Notification on the Windows 8 application.
  7. Get the Microsoft.WindowsAzure.Messaging.Managed.dll from the following link.
  8. Insert the notification hub as an attribute.

I will skip the second step which is so easy creating Windows Store application.

The third step go to create an account if you don’t have. After that submit your app, reserve your application name, then click on the third tile named Services.

Under the Services go to Authenticating your service

Copy the following package SID and the Client secret:

Now for the 4th step, in your created Windows Store application on Visual Studio right click on the project created and go to store and then click on associate App with the store. It will require that you sign in with the windows live account which you create the development account with. After that you will have to associate your application with the registered one on the store.

For the 5th step, let’s get back to the Azure account, in the Notification hub, we can get the connection information from the connection information under the service bus in the notification hub. Like the following picture:

The 6th step, is in your Windows 8 application to enable the toast push notification which is a very easy and small step. Just go to your Package.appmanifest and change the toast capable to “Yes”

The rest is for the development in the Windows Store, first thing we certainly have to do is to insert the libraries. So in the App.xaml enter the following libraries:






the next step is to create an instance of NotificationHub object:


And in the constructor of the app.xaml, initialize the instance of the object. Just don’t forget to change the DefaultListenSharedAccessSignature by its true value from the connection information retrieved from the Azure account in a previous step.

NotificationHub(“myhub”, “DefaultListenSharedAccessSignature”);

Initialize the notification by registering the channel by its Uri.






After that call the initialization function on the launch of the application or OnActivated.


The previous part was for receiving the notification for sending the notification the following code will solve the issue. Don’t forget to enter the necessary libraries.

You can enter the following code in the desired function:

NotificationHubClient.CreateClientFromConnectionString(“connectionstring”, “myhub”);

“<toast> <visual> <binding template=\”ToastText01\”> <text id=\”1\”>Hello! </text> </binding> </visual> </toast>”;


After that you will be able to develop the application as required, in the following link, you can find all the related development issues for Windows Store apps in this link, this one for the Android and the last one is for the iOS.

Now for further development I have done a simple Windows 8 application that sends and receive push notifications using Service Bus Notification Hub, you can download the source code from here.

The Notification hub for now supports only Microsoft Platform, Apple iOS and Android. Here is some video reference on Channel 9 that I hope it can help you during your development.

Here is one of my sources which explains everything in details about the Push Notification Using Service Bus.