1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Design an Application Storage and Data Access Strategy for Azure 70-534 Certification



Course Introduction
Start course


This course provides the practical knowledge and expertise you will need to master the Design an Application Storage and Data Access Strategy section of the Microsoft Azure 70-534 certification exam. In this session, we will cover: Options for data storage, mobile application back-ends, push notifications, web API and web jobs and hybrid data access patterns. We will also discuss Azure Media Services (streaming, video on-demand and monitoring).


Welcome back. In this lesson, we're going to be looking at notifications. By now I suspect most of us have seen our fair share of push notifications. An app notifies you that there's a deal on something you're interesting in buying, or if you play mobile games, maybe you've seen a notification letting you know that new content has been released.

Whatever your exposure is, push notifications are a part of modern devices and since push notifications are on every device, we need to be able to use them. That means we need to interact with the different platform notification services, or PNS. Each vendor has its own because they're the gatekeeper for the systems that run notifications.

This is the default PNS cycle. First the client app gets a handle from the platform notification service. Then the app passes the handle to the backend service for future reference. The backend server sends a notification to the platform notification service using the credentials that it fetched in the handle so that it can authenticate with the PNS. The PNS sends a notification to the device. If the handle is expired, then the PNS will reject the notification. In this workflow, our backend service doesn't communicate with the device directly. It's the job of the PNS to send push notifications.

Different platforms notify users in different ways with the user interface. For example, Windows Store and Windows Phone have toast and tiles. Apple iOS has its dialogues and so on. As we mentioned previously, every mobile platform has its own platform notification service. Windows has the Windows Notification Service, or WNS. Apple has the Apple Push Notification Service, or APN. They have different interfaces to integrate with them so not all functions are not going to be available to all of these different services.

Having to support them all, and understanding the nuances of all of them, makes to handling notifications a non-trivial task, especially at large scale. This is where Notification Hub comes into play. Notification Hub is a multi-platform, scalable, push notification infrastructure that minimizes the platform specific code that's necessary to be implemented. It supports multiple backend programming languages and it implements multiple delivery patterns such as broadcast to all users, Unicast and Multicast to single or groups of users, and segmentation with tags based on area of interest that are specified by the user on their device. It also supports personalization for specific devices with templates.

Let's check out an example of how to use Notification Hub. We're going to send a notification to a sample client application. So we're here in Visual Studio and we're going to add a new blank universal Windows project. We need to associate our app with the App Store. There we go. Next up we're going to use NuGet to add a library. We'll add the Managed Messing API. We're gonna just click through all of the prompts here. Perfect.

Okay, now that this is set up, let's drill into our C sharp file here, and let's scroll down. We're gonna add some code to handle the device registration with the notification service. There we go. Let's add the initialization function. Perfect, and now let's just clean up some of the missing imports. We just have a few to add. We'll add this. Okay, great. So there we are. Let's come back to this later.

Let's jump into the portal and check things out from the portal's perspective. We're going to create a new Notification Hub. So as always we have this blade to fill out. We need a name and we need a name space. Okay, and we need to select the tier. We're gonna go with the free tier and then let's just click on Create. Now that it's created, we're going to need to register our application that we'll use to receive our notifications. So we're going to select Windows. Then we're gonna need to add some additional data from the store where we registered the application. We have it here in Notepad so let's just copy and paste these values in. We're gonna click Save.

In the Access Policies we have the connection string that well need for listening to events. So let's go back to the application. We're gonna edit the code just a bit. We need to give the application name. There we go, and we need to provide the connection strings. Let's paste that in. Great. Now let's fire up the application. It takes just a second. It's a blank application, though that doesn't matter for this example. Notice that this dialogue popped up letting us know that the device has been registered. Now that the device is registered, we're gonna go back to the portal. Let's close out of a couple of these blades. We're gonna use the Test Send tool to send a message.

Okay, let's select our platform and the notification type. Then we need to add some text for our message. Let's send that. Okay, now that it's sent, you can see that we have a notification in the bottom right. So everything works and that's how easy it is to basically to get started with a demo of Notification Hub.

Okay, let's wrap up here. In our next lesson, we're gonna cover applications that use Web API. So if you're ready to keep going, then let's get started with the next lesson.

About the Author
Learning paths15

Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.