Preface - Learning Windows Azure Mobile Services for Windows 8 and Windows Phone 8 (2014)

Learning Windows Azure Mobile Services for Windows 8 and Windows Phone 8 (2014)

Preface

Windows Azure offers a wide range of cloud-based services, which are hosted on a robust, well-managed infrastructure, and can be easily scaled to meet our business demands. Windows Azure Mobile Services is a fantastic member of the Azure family, which allows mobile developers to quickly build web-connected applications and enhance user experience with push notifications.

Using traditional web technology, we will need to think about creating databases and web services, deciding what security mechanisms to use; build tools to administer the data and services; and write backend services to interface with the different Push Notification Service providers we want to use.

With Windows Azure Mobile Services, we can build model-first services without touching the database schema, get a fully managed and REST API for our data without writing a line of code, and modify the database API methods using scripts. Using scripts, we can also create API methods to access data, send push notifications, and make HTTP requests.

This book aims to investigate all that Windows Azure Mobile Services has to offer with practical examples, which can be used in real applications. Also, it covers areas of application development to enhance user experience, help with store certification, and improve development efficiency. I've created a simple game named TileTapper in C#/XAML for Windows 8 and Windows Phone to help illustrate use cases for all the service features and keep the book real!

The TileTapper game consists of a grid board seeded from a simple Boolean array of active or inactive tiles. When the app launches, it prompts the user to log in using the Windows Live connect authentication provider, downloads levels and current high score from our backend service, and then begins the game. The phone app game grid looks like the following screenshot:

Preface

The user has to tap on all the tiles before the time runs out to complete the level. The score at the end of the game as well as high score are stored in the service, if needed. Levels are generated automatically using a scheduled script and push notifications are sent about new high scores achieved and new levels created. Both apps have settings pages for managing notifications.

What this book covers

Chapter 1, Preparing the Windows Azure Mobile Services Portal, explains how to choose a subscription, set up an Azure account, and create a Mobile Service; it also talks about the current Mobile Services portal features.

Chapter 2, Start Developing with Windows Azure Mobile Services, covers what software and hardware you need to develop Windows 8 and Windows Phone 8 apps using Windows Azure Mobile Services. We'll also learn about creating preconfigured apps from the portal and connecting existing apps from scratch.

Chapter 3, Securing Data and Protecting the User, looks at permission options for tables and APIs and different authentication methods for protecting our data and users' personal information. We'll also look at developing code to log in users with an authentication provider and storing their credentials for subsequent app usage.

Chapter 4, Service Customization with Scripts, covers customizing scripts to perform validation, manipulate data, and make HTTP requests. We'll also look at installing a Node npm package and using it in on our scripts and finally, using the Git version control to pull a copy of our scripts to work locally and as a backup.

Chapter 5, Implementing Push Notifications, explains configuring Windows Store and Windows Phone 8 apps to implement push notifications; create a channels table to manage push channel URIs; and send Tile, Toast, and Badge notifications using the MPNS (Windows Phone) and WNS (Windows Store) providers.

Chapter 6, Scaling Up with the Notifications Hub, looks at the benefits of using the Notifications Hub from the service bus family of services, building on Chapter 5, Implementing Push Notifications. We adapt our code to register the push channel URI with the Notifications Hub, create scripts for sending notifications using the Azure for Node SDK, and use the Windows Azure Service Bus SDK to send notifications from .NET backend services.

Chapter 7, Best Practices for Web-connected Apps, looks at what we need to do to get our apps certified with respect to our Windows Azure Mobile Services implementation. We'll look at the app certification requirements for the Windows Store and UX guidelines and then talk about privacy statements, checking the cost impact of using the Internet connection and managing push notifications.

What you need for this book

Chapter 2, Start Developing with Windows Azure Mobile Services, details what software and hardware is needed, but as an overview, you need a machine with Windows 8.1 installed. If you want to create a phone app, it needs to be capable of running the Windows Phone 8 Hyper-V emulators. Visual Studio Express 2013 for Windows is needed for Windows 8 Store apps and Visual Studio Express 2012 for Windows Phone for phone apps. When we look at managing scripts with the Git version control, we need Git and also node.js for installing NPM modules.

Who this book is for

This book is aimed at developers wishing to build Windows 8 and Phone 8 applications with Windows Azure Mobile Services implementation. Basic C# and JavaScript skills are advantageous; also some knowledge of building Windows 8 or Windows Phone 8 applications is required.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows "The MobileServiceClient class has a Logout method that doesn't seem to do anything other than clear the CurrentUser property."

A block of code is set as follows:

public void Logout() {

this._mobileService.Logout();

// Clear credentials

StorageHelper.StoreSetting(USER_ID, null, true);

StorageHelper.StoreSetting(USER_TOKEN, null, true);

}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

GET https://tiletapper.azure-mobile.net/tables/leaderboard HTTP/1.1

X-ZUMO-APPLICATION: XXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxx

Host: tiletapper.azure-mobile.net

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Once this is done, copy Client ID and Client secret (v1) to the microsoft account settings section on theIDENTITY tab in the Windows Azure Mobile Services portal and click on SAVE."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.