Mobile Corner

Leverage Azure When Building Enterprise Mobile Apps with Windows Phone

Building line-of-business mobile apps for Windows Phone that connect to Microsoft Azure for authentication, data storage and notifications isn't much different from on-premises apps. Here's what it takes.

Microsoft has always been an integral part of a lot of businesses, whether they're small businesses that run Windows and Office, or large corporations that deploy Windows, Office and other applications to thousands of desktops. Its approach to the cloud aims to deliver cloud services for both developers and IT professionals, with additional services aimed at bridging the gap between the cloud and on-premises environments. In this article, I'll discuss how a line-of-business (LOB) Windows Phone application can take advantage of Microsoft Azure, while leveraging existing on-premises services such as Active Directory.

In some regard, LOB applications aren't too dissimilar to consumer applications. Both are made up of pages the user navigates between to either view or enter data. However, the usage patterns of LOB applications can differ quite considerably and are often more demanding than consumer applications. Most LOB applications require the user to authenticate, often using his corporate credentials, before he can access the application. A user typically expects the application to be much more responsive, showing each page of data immediately without waiting for it to be downloaded -- this is particularly true for offline scenarios where the user still expects to see a cached version of her data. The list goes on, but it's important the application is optimized for productivity for key workflows.

Traditionally, mobile applications were very rudimentary when it came to back-end services. Typically, the back-end would be a set of Web services, often hosted alongside the company's Web site, and the authentication would be maintained as a completely disparate set of credentials. The Web services would be the only back-end that the mobile application would communicate with for everything from authenticating the user, to reading and writing data. This strategy not only resulted in the user having to remember a separate set of credentials, it also created a potential bottleneck at the services.

When building a mobile application that connects to the cloud, it's important to identify different services that can be leveraged in order to deliver a more integrated experience, as well as leverage the ability to scale as provided by the cloud infrastructure. The following sections will identify a number of features of Microsoft Azure and how they can be applied to the development of a LOB Windows Phone application.

To put these services in context I'll use a fictitious LOB application that's used to inspect real estate properties (called Inspector). A user signs into the application before viewing the properties she needs to inspect. Inspections might be done in areas with limited or no Internet connectivity, so the application needs to work offline. Each inspection entails completing form-based data within the application, along with capturing photos or video of any potential issues. Any issues discovered during the inspection need to be triaged and then actioned by staff back in the office. Once all issues have been rectified, the inspector is notified so that he can sign off on the finalized inspection report.

Azure Active Directory Arguably one of the most important features of Azure from an enterprise perspective is Azure Active Directory. As a stand-alone feature it can be used to create and manage users and groups, as well as control access to other Azure services. However, what makes this feature so important is the ability to connect and synchronize credentials between an on-premises Active Directory service. This means that a user can sign into Azure services using the same corporate credentials he uses elsewhere.

In the context of the Inspector app, Azure Active Directory is used to authenticate the user and then validate that she belongs to the Inspectors group. Once validated the user can access the application.

Azure Mobile Services
Initially, Azure Mobile Services were created as an accelerator to help application developers create a scalable back-end for their mobile applications. While the foundations remain the same (SQL Database with a set of services exposing the data via a set of REST services), Mobile Services now support data synchronization, which makes them ideal for LOB applications that need to support disconnected or offline usage scenarios.

The linkage between Azure Active Directory and Mobile Services means that a user who has authenticated will then be able to connect to the Mobile Services. In turn, Mobile Services determines what data should be returned for the active user. So, rather than downloading all active inspections, the Inspector app only downloads those inspections assigned to the current user.

Blob Storage Mobile Services provides data storage and services for entity data, but isn't suited for large Blob data, such as images or videos. Blob storage can be accessed directly from the mobile application to read and write data. While access keys shouldn't be packaged within the application, it's possible to acquire a shared access signature via a custom service on Mobile Services, which will allow write access to specific Blob storage containers. To improve performance, Blob storage can also be exposed via the Microsoft CDN, making it significantly quicker to read data.

Throughout an inspection, as issues are identified, photos and videos can be captured within the Inspector app. These would in turn be uploaded to Blob storage during the synchronization process.

Service Bus/BizTalk Services
In some cases when data within the application changes, it might be necessary to send data back to an on-premises service. The Service Bus and BizTalk Services can be used to coordinate data exchange between on-premises services and Mobile Services in the cloud.

Issues identified during an inspection need to trigger an appropriate workflow back in the office. During the synchronization process, as issues are created or updated, a message can be routed through to an on-premises service that will queue up the appropriate action. This will allow work to be distributed among the office staff in order to get issues addressed in a timely manner.

Push Notifications Mobile Services also provides out-of-the-box support for Notification Hubs, making it straightforward for mobile applications to receive notifications when data the user is interested in changes. Notifications can either be toast or tile notifications, updating or notifying the user of the change in data, or they can be raw notifications used to trigger a background task in order to synchronize or update application data.

As issues identified during an inspection are actioned by office staff, notifications are sent out to the inspector to alert him of the updated status. Progress notifications silently update the information within the application. Upon completion of an issue, or perhaps the final issue for an inspection, a toast or tile notification is used to alert the inspector that the inspection is ready for finalization.

Scheduler Often LOB applications require periodic or scheduled actions to take place. The Scheduler service can be used to invoke services at a specific time, or on a recurrence pattern.

The Scheduler service is used to deliver status reports to management every Monday, indicating the number of inspections in progress, upcoming inspections for the week and the average completion rate for each staff member over the past couple of weeks. This provides management with the information they need to make strategic decisions on staffing, training and so on.

Application Insights While not essential for the operation of the mobile application, Application Insights can capture usage data, which can be fed back into the business. This data can report on how a user performs against his Key Performance Indicators, as well as aid application developers in improving and optimizing the application.

In the case of the Inspector app, having analytics on how inspectors use the app can be instrumental in educating users. The usage pattern users who have a high rate of completing inspections can be used to educate users with a low rate. This information can also identify areas of the application that need more work, or with which the staff have problems.

Developing modern LOB applications requires more than a simple set of back-end services. Early on in the development lifecycle it's important to identify data requirements, performance bottlenecks and integration points into existing on-premises environments. Each of these will help identify which Azure features make sense and how best to architect the data and service tiers of your mobile application.

About the Author

Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube