Building Windows Phone Applications Using Windows Azure

Building Windows Phone Applications Using Windows Azure

  • Comments 13
  • Likes

Phone + CloudWindows Phones provide many opportunities for developers to build great applications. Nevertheless, in some cases a developer is limited by the attributes specific to any mobile device – constrained processing, battery life, limited storage, and intermittent connectivity.  Consequently, it’s important to tie into services off of the device, ideally in a location with scalable processing, plenty of power, elastic storage, and ubiquitous connectivity. Enter cloud computing with Windows Azure.

In many ways, cloud computing levels the playing field. Any developer can tap into a larger – and virtually limitless – pool of resources from which to pull.  For developers, Windows Azure – Microsoft’s cloud-computing platform – is a great compliment to mobile application development. Simply put, Windows Azure allows you to focus on your application. You don’t have to worry about managing or monitoring the operating system, just as you don’t have to worry about the hardware our network. As a managed service, Windows Azure takes care of things items for you.

To make it easier for Windows Phone developers to use Windows Azure, we have created the Windows Azure Toolkit for Windows Phone. This toolkit provides a set of Visual Studio project templates that give you an advanced starting point for building Windows Phone applications tied into services running in Windows Azure.  The toolkit also includes libraries, sample applications, and documentation.

Today we’ve released version 1.3 which includes some great updates, including:

For more information on this release you can watch this video on Channel 9:

To get started, visit the Windows Azure Toolkit for Windows Phone on CodePlex. While you can review the source code online, I recommend you download the self-extracting executable. This tool not only gives you all the source code, but also a Visual Studio extension that includes the project templates and a dependency checker that ensures you have all the required prerequisites.

Configuration Wizard

Once installed, you’ll get two new project templates under Cloud templates – Window Phone Cloud Application and Windows Phone Empty Cloud Application.

Windows Phone Cloud Application

Create a new Windows Phone Cloud Application. This will launch a wizard that will collect information from you required for running your application with services. The wizard is adaptive, and will only request information based on what you select.

New Windows Phone Cloud Application Project

Choose both Windows Azure Storage and SQL Azure Database – this way you can try everything you. Just as Windows Phone provides an emulator for development, so too does Windows Azure provide an emulator to simulate running applications in the cloud. Consequently, in the next step, choose the Use Storage Emulator – you can always change this setting later. Similarly, for SQL Azure, choose Use local SQL Server instance.

One of the gems in this toolkit is the built-in support for the Microsoft Push Notification Service (MPNS) – without having to write a single line of code you can host your MPNS services in Windows Azure that are already connected to your application.

Microsoft Push Notification Service

In the last step, you can choose how to manage user authentication. The toolkit provides two forms of user management – a simple ASP.NET membership store (which provides typical username/password support) or the Access Control Service (ACS). ACS is a Windows Azure service that allows you to tap into existing identity providers such as Live ID, Google, Yahoo, and Facebook – in fact, even corporate identities are supported through ADFS. The toolkit makes using ACS extremely easy – not only will it collect information needed to use ACS, but it will also reach out to the ACS management rest endpoints to set everything up automatically. For a detailed explanation, see Windows Azure Toolkit for Windows Phone 7 1.2 Will Integrate With ACS from Vittorio Bertocci.

User Authentication

Once the wizard has run its course you’ll have a solution ready to run – so hit F5!

Login

You are first presented with the opportunity to login. Depending on the user authentication mode you choose, you’ll either use ACS or create a new user.

NOTE: In order to consume the REST services over HTTPS in a phone device or in the Windows Phone Emulator, you need to use a trusted SSL certificate. If you do not have one, you can use a self-signed certificate, but you need to install it in the phone before consuming the services. Since the Computer Emulator always uses the 127.0.0.1 self-signed certificate, we need to install it in the Windows Phone Emulator before continuing with the next steps.

Once you’ve logged in you can start to try out the various aspects of the toolkit. There are five areas to explore:

  • Push Notifications
  • Windows Azure tables
  • Windows Azure blobs
  • Windows Azure queues
  • SQL Azure

To make it really simple to try out and test the push notifications – as well as provide you a demonstration of how to go about registering a notification channel, storing it in Windows Azure tables, and then sending a message to the phone – we have also included a simple web application that you can use to send notifications to the phone. First, enable push notifications on the client …

Enabled MPNS

… then log into the web application running in the Windows Azure compute emulator (admin login is listed in the documentation) and choose the Microsoft Push Notifications tab. You should see a channel established for your user. Type a message then click Send Raw.

Send a notification

Back on the emulator you will see that the application has received the message from the MPNS. Try it out for toast and tile notifications too!

Receiving a raw messageReceiving a toast and tile message

Not bad for an out-of-the-box experience! You can also test out toast and tile notifications.

While this is a sample application, the value is that it includes all the required piping to handle the Windows Phone push requests from the client, surfacing them through the web application, and then letting the admin send notifications back to the phone.

And of course, there’s more – explore the ability to create and delete tables, enter rows of data, upload pictures from the device camera into blob storage, enqueue and dequeue messages in queues, and display read-only data in SQL Azure.

BabelCam

One of the more recent updates to the toolkit includes the sample application BabelCam. BabelCam started as a proof-of-concept application I built for my MIX11 talked Building Windows Phone 7 Applications with the Windows Azure Platform. Since then we’ve not only cleaned up and included the source code, but we’ve also published to the Windows Phone marketplace – download BabelCam and try it out!

We’ve been able to move very quickly in developing this toolkit, based largely on great feedback we’ve received from users – please keep it coming! As a refresher, here are some of the updates we’ve made over the last six months:

Mango opens up a lot of new opportunities for us to build new capabilities and applications that combine the best of Windows Azure and Windows Phone – exciting times ahead!

Be sure to download the Windows Azure Toolkit for Windows Phone today.

13 Comments
You must be logged in to comment. Sign in or Join Now
  • tgurda
    1 Posts

    Many mobile app clients are mobile app operators serving emerging markets. The penetration of mobile apps in this space is more complex; for one thing, the majority are using feature phones. The market for apps created for feature phones will almost double to US$ 1 billion by 2016, betting that feature phones will still account for the largest share of devices worldwide at that point, at a 63% global share. This is a contentious point, as you could argue that the price of smartphones will go down (especially with the rise of the Android platform), thereby encouraging emerging market users to take up the devices. Of course, 3G coverage would have to improve, or this would be pointless. Either way - all roads lead to a steady rise in the use of mobile apps.

    Many of the things that have historically done well on the web – social networks, product and service reviewing, dating, buying and selling – do even better when you make them local and mobile apps. The privacy and personalization we get from web sites can now be further enhanced with mobile app features to ensure that whatever we are doing is tailored for where we are and what we want at any given moment. For example, why would you want to date someone who lives 100 miles away? (Unless, of course, you are happy to spend most of your dates on Facebook or Skype – I’m not judging here.)

    In My opinion, the best mobile app for How to Meet Girls is also listed on the source of this information.  There are quite a few good articles.

    Source: www.customizedmobileapps.com

    Written by Tom Gurda

    May 16, 2012

  • The Windows Azure platform offers an intuitive, reliable and powerful platform for the creation of web applications and services.

    www.ezeeprinting.com/.../door-hangers

  • Fantastic post. Here’s a tool that lets your build your database apps in the cloud fast, and

    withoutcoding http://www.caspio.com/

  • Most excellent article. May I also recommend these articles:

    "A cloud-based phone app in 5 minutes" @ blog.jerrynixon.com/.../mango-sample-cloud-phone-app-in-5.html

    and

    "Mango Sample: External Data" @ blog.jerrynixon.com/.../external-data-sure-data-doesnt-have-to.html

    and

    "Mango Sample: Consume Odata" @ blog.jerrynixon.com/.../mango-sample-consume-odata.html

    Thanks,

    Jerry Nixon

  • Having the same issue as kamaljaiswal  "Sorry, an error occurred while processing your request " when running the web app on both my work PC and home PC, is there a setting that i am missing?

  • arekpio
    13 Posts

    thanks for autho for this interesting informtions

    my site: http://www.stoliki-lustra.pl/

  • I've just posted a fix to your issue on CodePlex - thanks for pointing this out!

    watwp.codeplex.com/.../72585

  • cb55555
    4 Posts

    @Wade Wenger - Added to issue tracker.

    In the mean time, is there a way to force installation?

  • Thanks for the feedback and details, @cb55555 and @kamaljaiswal. I'll take a look. It would be helpful to log this information on the CodePlex portal so we can track the work items and follow-up with you when we check-in fixes. Thanks!

  • gr8 work .  

    when i try to run the web app it gives me "Sorry, an error occurred while processing your request."  and not working on wp7 emulator .

    using expression vs 2010 for wp7 and web .

    thnx

  • cb55555
    4 Posts

    I'm getting a dependency check failure on Entity Framework 4.1. I have EF 4.1 Update 1 installed.

    The dependency checker is linking to an older EF 4.1 download, Version 4.1.10331.0 dated 4/8/2011.

    EF 4.1 Update 1 is Version 4.1.10715.0 dated 7/22/2011.

  • I would like to reiterate the comment about azure pricing. I am currently using either Google AppEngine or AppHarbor (https://appharbor.com/) for all of my WP web services. Microsoft should really consider Google's pricing model (charge for actual computing hours, not up-time hours). This has been something the community has been screaming about since Azure's release and I really hope MS considers it.

  • mikestu
    8 Posts

    I would like to see some kind of minimal Azure offering at zero cost to people that already paid the $100 developer fee to make apps for Microsoft's product.  If they need more Azure resources than that minimum, you'd have to then pay more.  If all I need is a simple web service or two in order to do some notifications on my phone, along with a simple database, right now I'd rather just pay for a cheap hosted ASP.net account somewhere, then move it to Azure if I need more scalability and processing.  If you want people to not do this, and start out using Azure right out of the gate, then you're going to have to change something, and a 90-day free trial is not going to get everyone to use it.  Also, not everyone wants to bother with a Bizspark account or is a student.  Believe me, I'm not the only one saying this too (wpdev.uservoice.com/.../1719923-free-minimal-auzre-instance-for-wpdev).  This toolkit sounds awesome, and I will definitely check it out, but please give us a 100% free way to use a minimal Azure instance as long as we have an active App Hub account.