Over a million developers have joined DZone.

Mango Sample: A Cloud-based Phone App in 5 Minutes!

DZone's Guide to

Mango Sample: A Cloud-based Phone App in 5 Minutes!

· Cloud Zone ·
Free Resource

Discover a centralized approach to monitor your virtual infrastructure, on-premise IT environment, and cloud infrastructure – all on a single platform.

When you create a Windows Phone application you might have some data to store. Where do you store it?

  • Well, there’s always Isolated Storage. I discuss that here
  • There’s always a local SQL Database. I discuss that here.

But, what if on-the-phone isn’t good enough? …to the cloud! I discuss that here [there’s no link because this is the article! :)].

Why the cloud?

There are lots of great reasons. Here are a few:

  1. Your data needs to be updated or refreshed, call the cloud
  2. Your data needs to be saved for roaming users, call the cloud
  3. Your data is huge and phones only need a bit, call the cloud

Before you do anything, you might want to check if there’s even a network to use. To detect the network, WiFi, and so much more, read this article.

Service References

Creating a Service Reference to some remote Web Service is a snap.

MSDN: The Internet is host to an extensive variety of web and data services that you can use in your Windows Phone applications to create compelling new user experiences. This topic introduces networking and web services, and describes the primary classes and utilities that you can use for building web-integrated Windows Phone applications. [snip/] Because the vast majority of web services published on the Internet are based on HTTP, you can use the HttpWebRequest and WebClient classes to access web services from Windows Phone applications. To help ease the task of generating the additional code that web services often require, you can use the Silverlight Service Model Proxy Generation Tool (SLsvcUtil.exe) or the Visual Studio Add Service Reference feature to generate a proxy class.

Security Consideration

When connecting to a web service that requires an application key, do not store the application key with an application that will be run on a device. Instead, you can create a proxy web service to authenticate a user and call an external cloud service with the application key. For more information about security recommendations, see Web Service Security for Windows Phone.

Let’s see it!

In the video featured on my blog, we’ll create both the phone application and the web service.

I create a service-based Windows Phone application. I’m the kind of guy who likes to have samples be simple so I can get the technique without having to understand some complex back story. Hopefully, that rings helpful for you like it does for me. Here are the key steps:

  1. Create the Windows Phone application project
  2. Create the Windows Communication Foundation (WCF) service application
  3. Implement the logic in the WCF service
  4. Add a Service Reference to the WCF service in the WP application
  5. Implement the UI in the WP application
  6. Call the service and watch the magic


Adding cloud services to your windows phone application can add a lot of flexibility and power to your application. The better your application, the less likely users will hit that UNINSTALL button – after all, that’s what we are working against, here, right?

A few gotchas to remember:

  1. Using the cloud means you need a network
  2. The user might be out of signal reach
  3. The user might be in airplane mode
  4. Be a good bandwidth user – don’t overdo it

Adding a Service Reference creates the asynchronous proxy code for you – then, as the developer, the rest it up to your creativities.

Best of luck!


Learn how to auto-discover your containers and monitor their performance, capture Docker host and container metrics to allocate host resources, and provision containers.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}