14.01.2015 Views

Eric lippert - Amazon Web Services

Eric lippert - Amazon Web Services

Eric lippert - Amazon Web Services

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Azure Mobile <strong>Services</strong> and Push<br />

Notifications<br />

Building ‘ZumoFakeTweet’<br />

Azure mobile services step in and help developers by simplifying<br />

the <strong>Web</strong> Service/Notification Server logic. Azure Mobile <strong>Services</strong><br />

provide the following for us:<br />

1. An Entity Store for easy data access and storage. It uses Azure<br />

SQL DB as its backing store.<br />

2. A client side communication library so you don’t have to deal<br />

with Raw HTTP Requests.<br />

3. Secure Storage for App SID and Client Secret (these should<br />

not be distributed with the clients).<br />

4. Communication with WNS.<br />

Configuring Windows 8 App, Azure Mobile Service<br />

and WNS<br />

1. We start off by Logging into our Developer Dashboard and<br />

creating a new Application. To do so, you have to click on the<br />

‘Submit an app’ menu item on the left hand menu bar.<br />

This significantly eases our task of building and managing Push<br />

notification service for our Mobile Apps.<br />

The Use Case<br />

Ideally we would like to build a Twitter client with push<br />

notifications, but that is a non-trivial example that can nearly<br />

span a book much less an article. So today, we’ll build a fake<br />

Twitter application. Something, that is distantly similar to<br />

Twitter, only if you look at it with a very obtuse angle. We’ll call<br />

this app ZumoFakeTweet!<br />

Application Design<br />

It will be a simple app that accepts a User Name identifying the<br />

user of the App. The premise of the App is to send out FTs (fake<br />

tweets) and FDMs (fake Direct Messages).<br />

FTs are pushed to everyone whereas FDMs are pushed to the<br />

user whom we intend to send it.<br />

2. Click on the App name and provide the name of your App.<br />

If you already have an App that you want to add notification<br />

capabilities to, select ‘Advanced Features’. We provide the name<br />

‘ZumoFakeTweet’ and move on to the ‘Advanced Features’.<br />

3. In ‘Advanced Features’ page, click on the ‘Push Notifications<br />

and Live Connect Info Service’. This pops up a new browser (you<br />

may have to re-login with your Windows Store developer<br />

account credentials). The First Step here is to ‘Identify the<br />

Application’. As you can see below, you can either do it via Visual<br />

Studio or do some manifest file hacking later. We will create our<br />

Windows 8 Store App at this point.<br />

But First a set of Pre-Requisites<br />

1. You’ll need an active Azure Account and even though Mobile<br />

<strong>Services</strong> are in Preview and the first 10 are free, you’ll still need<br />

an Azure SQL Database that may cost you depending on your<br />

plan.<br />

2. You will need a Windows 8 Developer account to follow<br />

through with the Push Notification Setup and implementation.<br />

3. Access to a Windows 8 machine with Visual Studio (Express<br />

will do).<br />

With the basic premise set, let’s look at the pre-requisites and go<br />

ahead and build the Windows 8 Application.<br />

4. To get started with the ZumoFakeTweet project, start Visual<br />

Studio, select new Windows 8 Project and pick a Blank Template<br />

DNcmagazine www.dotnetcurry.com | 73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!