Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Windows Phone 7 Console Window on 64 bit machine

A while ago as part of my post how you can enable the console window for the Windows Phone 7 emulator. Since I upgraded my machine to 64bit windows I haven’t got around to enabling the console window but today I decided to give it a shot. Now my previous post stated that you just needed the following registry entry:


However, this wasn’t working for me…. and actually the XDE key didn’t even exist. Of course, I’m running a 64 bit machine and a lot of the Windows Phone 7 SDK runs in 32 bit mode. Doh! should have realised that of course I’d need to alter the registry key to the following (note the additional Wow6432Node key)


Now I can run the console window and write to it using Console.WriteLine (as an alternative to Debug.WriteLine which appears in the Visual Studio debug Output window).

eg Console.WriteLine("Application Loaded");


Windows Phone 7 Competition – User Failure and Update

Ok, firstly an apology – it appears that in setting up the alias for competition submissions (ie competition @ I seemed to have not setup the email forwarder correctly. As such I suspect there were a few entries that went astray for the first two rounds of the LG App Starter Competition.

If you submitted your application in the first two rounds and didn’t receive a response from me, please resubmit them (same email address) and I’ll include them in this weeks competition round.

Windows Phone 7: Golden rule for MediaElement / IIS Smooth Streaming

“If in doubt…. reboot the device and try again”

I spent a lot of today messing around with IIS Smooth Streaming, trying to get various things to work from a Windows Phone 7 application. It was only after a day of frustration that I decided to reboot the device, and then as if by magic it all started to work. I’ve seen similar things to do with the MediaElement so I imagine it has to do with the media stack on the device getting its knickers in a knot.

Windows Phone 7: LG App Starter Competition–Round 3

We’re now two weeks into the LG App Starter Competition and today’s the beginning of Round 3. This week’s topic is quite broad covering Travel, Navigation and Social.

Round 3

Topic: Travel, Navigation and Social
End Date: 6pm (EST) Sunday 23rd January 2011

If you missed out on round 1 or 2 but still have an idea related to Sports, Health and Fitness, or Business, Tools and Productivity, don’t forget you can still enter the final draw. All you need to do is submit your application to marketplace and send through the details.

Full details for the competition: Competition time for Australian Windows Phone 7 Developers

Bogus Windows Phone 7 User Agent String

A question that repeatedly comes up is how to detect when your website is being accessed by a Windows Phone device. In most cases this discussion ends up with some form of browser detection via the User Agent string. A quick Google/Bing will reveal a number of articles on this topic. In the past I’ve simply referenced Mads Kristensen’s post, Windows Phone 7 user agent. In this post he indicates that the user agent string should look similar to

Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6

This is consistent with what the document Designing Web Sites for Phone Browsersstates in the discussion around server side browser detection. Here the user agent string example they give is

Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) <DeviceManufacturer>;<DeviceModel>

Unfortunately yesterday I was testing a new service I was building (more on that in the coming weeks) that uses the User Agent string. My initial testing with the emulator worked correctly. However, when I got to testing with my LG Optimus 7 device the service was failing because it couldn’t detect that the device was a Windows Phone 7 device. Turns out that the device is sending through a totally bogus User Agent string

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; XBLWP7; ZuneWP7)

My initial reaction is that this sucks! In fact, after further review, it still sucks! How can a device claiming to be a Windows Phone 7 device (and having gone through the Microsoft certification process) emit such rubbish in the User Agent string. The platform is Windows NT 6.1….. really??

Update: Here’s another list of user agent strings that at the time of writing is missing this one -

Update: Someone quite rightly pointed out that this user agent was a result of using the desktop browsing option in IE on the device. Flipping back to mobile browsing restores the correct user agent string as per the above posts. Upshot: you still need to be aware of the different user agent strings that may be sent by a Windows Phone device.

Windows Phone 7 Application Acceleration

Welcome to 2011 for all you Windows Phone 7 application developers! This year is set to be a massive year for you as there are already two competitions up and running:

- Windows Phone 7 App Challenge

- LG App Starter Competition

Now, to give you even more Microsoft have invited me to help run three Windows Phone 7 application acceleration events. This time around we’re hitting Sydney, Melbourne and Perth with a two day event that will give you the skills (training on day 1) and advice (application workshop on day 2) in order to build your first (or second, third….) Windows Phone 7 application and get it into Marketplace.

Day 1: Windows Phone 7 Developer Training
Session 1: Introduction and Windows Phone User Experience Overview
Session 2: Animation, Orientation and Overlays
Session 3: Application Lifecycle, Navigation, Application Tiles and Notification
Session 4: Tasks and Touch
Session 5: Working with the Accelerometer, Sounds and Location
Session 6: Connecting and Consuming the Web

Day 2: Windows Phone 7 Application Workshop
Phase 1: Present your application – 5 minute elevator pitch* with or without demo.
Phase 2: Workshop/Develop your application
Tips & Tricks: As many little bits and pieces Nick can cram into an hour
Phase 3: Continue working on your application
Phase 4: Round up – summarize what you got done and what still needs to be done to get your application into Marketplace**.

Day 1 is designed to equip you with the fundamentals of building a Windows Phone 7 application. With these new found skills, Day 2 is designed to jump start your application development process. Whether you're just starting your first application, wanting some assistance getting your application ready for Marketplace submission or help troubleshooting some issues, the application workshop is where you should be. During the day I’ll spend time reviewing your application, suggesting areas for improvement and help you resolve any challenges you might have encountered.

* This isn't a traditional presentation – I will spend a few minutes with you going through your application idea. 0 stress! Just walk through what the idea entails, what you think will make it a rockin' app and perhaps the areas that you think you'll need/want some help with.

** For applications ready to submit to Marketplace there are a number of Marketplace tokens available.

Sydney (registration) - 24/25th January 2011
Perth (registration) - 27/28th January 2011
Melbourne (registration) - 31st January/1st February 2011

Windows Phone 7: LG App Starter Competition–Round 2

Last week the theme for round 1 of the LG App Starter Competition was Sports, Health and Fitness. Today is the beginning of round 2 and we have a new topic:

Round 2

Topic: Business, Tools and Productivity
End Date: 6pm (EST) Sunday 16th January 2011

If you missed out on round 1 but still have an idea related to Sports, Health and Fitness, don’t forget you can still enter the final draw. All you need to do is submit your application to marketplace and send through the details.

Full details for the competition: Competition time for Australian Windows Phone 7 Developers

Competition time for Australian Windows Phone 7 Developers

Update: The final round of this competition has been extended by two weeks to ensure you get your application into marketplace in time to enter the competition!

Update: In the initial post there was an error in the final paragraph that said round 1 would be open until 9th February. This is NOT the case. Round 1 will close at 6pm EST on the 9th January 2011.

Dev V’s Dev


Late last year Microsoft Australia announced the Windows Phone 7 App Challengewith the grand prize being a trip to Las Vegas for MIX11. To enter all you need to do is build an application, submit it to marketplace and then complete the entry form. Don’t forget to read the Terms and Conditionswhich outlines the relevant dates and the specifics for the competition.


LG App Starter


As I mentioned in my post Windows Phone 7 Competition time with LG. I’m running a small competition in parallel with the Windows Phone 7 App Challenge. Thanks to LG, Microsoft and Built to RoamI have a number of prizes to give away over the next 4-6 weeks:

- LG: The major prize is an LG Optimus 7 device. I reviewed this device late last year in my post LG Optimus 7- Up and running in 5 minutesand it is truly a wonderful device to use.

LG Optimus 7_01

- Microsoft: Marketplace tokens. Microsoft has been kind enough to donate a number of marketplace tokens. These cover the initial cost of signing up for a Marketplace account.

- Built to Roam: Books. We have three copies of Professional Windows Phone 7 Application Development and two copies of Professional Visual Studio 2010 to give away.

Competition Playbook

In Short: This competition will run for six weeks. For the first four weeks I will be selecting a topic and you’ll have that week to come up with an idea for an app. To enter all you have to do is email me your idea before 6pm EST on Sunday. The weekly winner will be announced later that same evening. Each week we’ll be giving a way marketplace tokens and a book. The final two weeks are where you get to actually build your application, submit it to marketplace and email me a link to your application. The competition will close at 6pm EST Sunday February 27th and I’ll select the winning entry who will win the LG Optimus 7 device.

In Full:


Competition Start : Right Now! (10am EST 3/1/2011)

Competition End : 6pm EST Sunday 13/2/2011

Round 1:
- Topic: Sports, Health and Fitness
- Deadline for ideas: 6pm EST Sunday 9/1/2011

Round 2:
- Topic: Business, Tools and Productivity
- Deadline for ideas: 6pm EST Sunday 16/1/2011

Round 3:
- Topic: Travel, Navigation and Social
- Deadline for ideas: 6pm EST Sunday 23/1/2011

Round 4:
- Topic: Finance, News and Weather 
- Deadline for ideas: 6pm EST Sunday 30/1/2011

Final Round:
- Submit your application and send through link to your Windows Phone 7 application
- Deadline for submission: 6pm EST Sunday 27/2/2011


In order to enter this competition you need to meet the following requirements:

- You, or your company, must be Australian

- You can’t submit an application you already have in marketplace prior to the beginning of this competition.

- To be eligible for the final round your application must have been submitted, certified and made available for download/purchase via marketplace (ie published).

- You are encouraged to enter your idea into one or more of the rounds but this is not a requirement. If your application doesn’t fall into any of the topics selected for rounds 1-4 you can simply put forward the application in the final round.

- My decision is final. I will publish the names of the round winners (and links to their blog/website if available) but not their application ideas. I will list all entries into the final round (unless you specifically indicate that you don’t want to be included in this list) along with the winning entry.

What to include

Rounds 1-4: You’re pitching an idea. You can submit as much or as little as you like. If you have a working prototype that helps convey what the idea is but you may decide that you just want to mock up some wireframes and send through in an email describing what your idea is.

Final Round: I only need a link to your application. Please do NOT include any further description of what your application is/does as it will be ignored. To make this a fair competition I will be judging this based on what is available via Zune/Marketplace (ie make sure you think about your application logo, description, keywords etc when submitting it).

Minimum Requirements: When you send me your submission for either stage, please include the following:

- Full name
- Contact phone number (ideally mobile number)
- Postal address (just in case you win!)
- Twitter/Facebook/Blog/Website (so I can link to you in the case that you win)

Please send all entries to competition @

What I’m looking for

You can think of this competition as a warm up for the Windows Phone 7 App Challenge. I will be judging the entries and will be looking for the applications that best make use of the Windows Phone 7 features. To get you started, here is a list of features that you could consider using:

- Push notifications (Tile, Toast or even Raw)
- Accelerometer
- Audio (playback or recording)
- Video (using MediaElement or IIS Smooth Streaming)
- Location
- Mapping
- Panorama and/or Pivot
- Animations
…… (the list goes on) …..

Time to get started

This post launches the competition and the first topic for round 1 is “Sports, Health and Fitness”. You have until 6pm EST Sunday 9th January to send through your application ideas. Email all entries to competition @

Getting to know the Identity of your Windows Phone 7 Application

There are a number of reasons why you might want to know the identity of someone using your application. Most revolve around the need to store and track personalised information and to be able to uniquely identify any individual user. In your Windows Phone 7 application there are actually three different identities that you may be interested in:

User Id

In order to get the most out of their Windows Phone 7 device (including being able to access marketplace in order to download and install applications and games) a user will need to sign in with a Windows Live Id (or an XBox Live gamer tag). From your application you are able to retrieve a unique identifier that can be used to identify this user. If the same user uses the same Windows Live Id to sign into two different Windows Phone 7 devices and runs your application, the application will see the same identifier. If the same user uses two different Windows Live Ids, then your application will see two different identifiers.

Note that I use the word “identifier”, this is intentional as what you get back doesn’t include any profile information (not even their actual live id) about the user. The following code extracts the 32 character anonymous identifier (ANID) from the UserExtendedProperties class.

private const int IdentifierLength = 32;
private const int IdentifierOffset = 2;

public static string UserId()
    object anid;
    if (UserExtendedProperties.TryGetValue("ANID", out anid))
        if (anid != null && anid.ToString().Length >= (IdentifierLength + IdentifierOffset))
            return anid.ToString().Substring(IdentifierOffset, IdentifierLength);

    return null;

Note: To access properties in the UserExtendedProperties class you need to demand the ID_CAP_IDENTITY_USER capability in the WMAppManifest file for your application.

Device Id

Alternatively, you may want to identify each device that your application is being run on (this will help resolve the situation where a single user signs into two devices with the same Windows Live Id). This is done using the DeviceUniqueId property from the DeviceExtendedProperties class.

public static byte[] DeviceId()
    object uniqueId;
    if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)){
        return (byte[])uniqueId;

    return null;

Note: To access the DeviceUniqueId property you need to demand the ID_CAP_IDENTITY_DEVICE capability in the WMAppManifest file for your application.

Application Id

There are certain cases where you will want to be able to uniquely identify the application (for example, if you write a user control, or a reusable library you might want to be able to identify applications where they are being used). The easiest way to uniquely identify the application is via the ProductID attribute in the WMAppManifest.xml file.  eg

<?xml version="1.0" encoding="utf-8"?>
  <Deployment xmlns="" AppPlatformVersion="7.0">
    <App xmlns="" ProductID="{df09bbd2-efb5-4135-8a2e-355222ca8b44}" Title="WindowsPhoneApplication4" RuntimeType="Silverlight" Version="" Genre="apps.normal"  Author="WindowsPhoneApplication4 author" Description="Sample description" Publisher="WindowsPhoneApplication4">

You can easily open this file in Visual Studio by expanding out the Properties node in Solution Explorer and double-clicking the WMAppManifest.xml file. However, simply copying the ProductID value out may result in the wrong value. This attribute can be modified by the marketplace certification process. Once you have started the submission process for your application, if you look at the details of the submission you will see that a new ProductID has been generated. eg


Having to manually extract the ProductID this way is somewhat tedious and from a user control/library developer perspective not very reliable (a developer could pass in the same ProductID for all their applications and thus only pay once). An alternative is to access the WMAppManifest.xml file that gets deployed with the application. When you compile your application it generates a .xap file. This is little more than a compressed file (try changing the extension to .zip and extract the contents) which is expanded into a folder on a Windows Phone 7 device when it is installed. To read the contents of the WMAppManifest.xml file all you need to do is open it the same way as you would any other content that has been packaged with your application.

public static Guid ApplicationId() {
                using(var strm = TitleContainer.OpenStream("WMAppManifest.xml"))
                    var xml = XElement.Load(strm);
                    var prodId = (from app in xml.Descendants("App")
                                  select app.Attribute("ProductID").Value).FirstOrDefault();
                    if (string.IsNullOrEmpty(prodId)) return Guid.Empty;
                    return new Guid(prodId);

That was relatively straight forward…. oh, don’t forget to add a reference to the Microsoft.XNA.Framework assembly which includes the TitleContainer class.


The following screenshot shows the results for each of these identifiers. Note that because this is from the emulator where there is no signed in user, the User Id is null/empty.


Where’s my Pink Windows Phone 7?

It would appear that Apple, Google and Microsoft have been so intently focussed on competing to build the best phone operating system they’ve forgotten that a large proportion of the phone sales are based on the look of the phone rather than functionality. For example, take a look at a selection of the Windows Phone devices that are now available on the market. One word….. BORING….. actually a second word comes to mind….. GEEK. That’s right, the designs are boring, lack imagination and a for a predominantly technical male audience.


Now before you think that I’m having a go at Windows Phone, if you take a look at the Android devices available they’re no better (in fact most look similar to the above which is no surprise since they’re mostly by the same set of device manufacturers). Apple is slightly different in that they at least employ decent industrial designers. If you look at the iPhone 3 design (white and black) they had sex appeal to a design conscious audience, and surprise surprise it worked. They had lust appeal and your average consumer wanted one, often without knowing why.

In my mind the iPhone 4 takes a somewhat different take. Whilst not being a sexy as previous devices, the unique look at feel that Apple has created, and the return to a metal shell, appeals to a more corporate user (no surprise as Apple tackles the enterprise space, fighting RIM and Microsoft for control of the corporate users).

So, what’s missing? Well I think that there are two audiences that are being missed. Firstly the “Pink” market – 15-25 year old predominantly female market – that want a phone that has bright colours and is easily identifiably theirs. Take for example my PS3 controller….. it’s bright pink and I know it’s mine!


The second market is what I’ll call the “Accessory” market – those users who want to change the shell of their phone and hang attachments/accessories off them. Both Android and Windows Phone devices lag behind the iphone market in the number of accessories available for them (eg docking stations, speakers, protective covers, credit card sleaves). However, this is nothing compared to the Nokia market. Next time you’re in a Westfields or other large shopping centre, look out for the mobile phone accessory counter (there is sure to be one). So many accessories, mostly for the feature phones by Nokia, Motorola etc.

Whilst I think that Windows Phone 7 is an awesome platform there is no sex-appeal to the hardware. Given the number of different manufacturers making devices, I’m surprised by the complete lack of imagination…. give me a pink Windows Phone.

Some Advice on the Windows Phone 7 AppHub

The submission process for Windows Phone 7 applications into the Marketplace is done via the AppHub and there are some interesting quirks that you may come across or have to work around. Here are just a few hints to get you started:

Registration: Register for the AppHub today. Yes I know if costs money but if you’re going to be releasing something via marketplace you’re going to need an account eventually. It’s best to get this process done as early as possible to avoid delays when you’re app is ready to submit.

Free Applications: If you going to submit free app be aware that you get 5 free submissions. If your application fails to pass certification that will count as a submission (so if you succeed the second time around you’ve used 2 of your 5 free submissions). For free apps, make the first submission the equivalent of Hello World (ie so simple that it can’t possibly fail) but DO NOT check the box at the end of the submission process that will automatically publish your application after certification. Once your application has passed certification all further updates to that app are free – now you can add all the real functionality, fails as often as you like, and not have to worry about using any more of your free submissions. When you’ve certified a version of your application that you’re happy with, then you can choose to publish it.

Updates: Every time you want to update your application you need to complete the entire submission process again (including uploading all the artwork, descriptions, keywords etc). To make this process easier, each time you publish your application, immediately start a new application update and copy all the existing values from the current application into the new submission. Then, when you do decide to update the application, you can quite easily change the xap file in the new submission and send it off for testing. I can’t urge you enough to double-check all values in the new submission to make sure they are correct….. the last thing you want is for your application to be listed as a game…..

Reviews: There is currently no way to provide feedback to users who have provided a review of your application. However, you, as the author, can download your own application and provide a review that responds to any feedback or comments from other users. You might want to annotate the review with “authors comment” or words to that effect to indicate that you are the author (don’t forget to rate your application of course – how many stars do you think it deserves?)

Windows Phone 7 WebBrowser and WebBrowser Control Site Formatting

Today I found myself revisiting a problem I encountered a few months back whilst trying to get a website to correctly render on a Windows Phone 7 device. There are a few pages that discuss how to do this through the user of the viewport meta tag:

Following these posts it would be easy to come up with a viewport meta tag that look like the following (or you could set the width property of the viewport meta tag to device-width, depending on the size of your content)

<meta name="viewport" content="width=208;height=377;user-scalable=no" />

This will NOT work, where as the following will work nicely….. spot the difference?

<meta name="viewport" content="width=208,height=377, user-scalable=no" />

Yes, that’s right you must separate the values with COMMAS not semi-colons (even that works on most other mobile platforms such as the iphone). Repeating that…. separate the name-value pairs in the content attribute of the meta tag with commas.

Windows Phone 7 Competition time with LG

This is a heads-up that we’re going to be running a competition in the coming weeks to win a brand new Windows Phone 7 LG Optimus 7. Get Visual Studio and Expression Blend started and be ready to put your development skills to the test. More details to come in the next couple of days…..

Free versus Trial Windows Phone 7 Applications

Oren Nachman has clarified some of the confusion surrounding free applications on the Windows Phone 7 marketplace in his post WP7 Marketplace Tip #2.5 - Free App + Updates Policy Clarified (finally). Ok, so the upshot is that you have 5 submissions for free apps but unlimited paid apps. So you might be thinking…. but I have a ton of ideas that I want to build free apps (that make money via ads or subscriptions etc). The trick here is that Windows Phone 7 applications support trial mode.

As a developer it’s completely up to you as to what you do in trial mode – the typical things are to limit functionality or time limit the application. But if you’re creating an application that you want to be free, just submit it as a paid application with trial mode enabled (an option when you submit your “paid” application). Simply completely ignore this flag and just allow users to use the full functionality of your “free” application. Of course if users decide to pay you for the application then you’ll get that too (win win all around if you ask me, of except Microsoft who won’t make their 30% unless users purchase your application).

ChevronWP7: Community Enabler or Jailbreaking Tool?

There has been a lot of debate regarding the recently released ChevronWP7 tool by Rafael Rivera, Chris Walshand Long Zheng. The debate focuses around the intent of this tool – some say that it amounts to a tool that can be used to jailbreak a windows phone 7, others (including the authors) insist this is just enabling functionality that is already available with any windows phone 7 device.

Personally I am somewhere in the middle – I don’t see this as a jailbreaking tool since it doesn’t permit any access to the inner workings of the device, it just allows applications to be sideloaded. On the flip side, I don’t agree with the argument that they are just enabling functionality that ships with the device – if that was the case then Microsoft would publish a similar tool and not require the registration with marketplace. Sorry boys, Microsoft sets the rules, if you don’t like them then I’d suggest running a muck with Android or Windows Mobile….

With that said, I do like one of the intents behind the tool, which is to simply discover more about the inner workings of Windows Phone 7. But again, if this was truly one of the objectives, then why did they decide to obfuscate the code…..

Code Obfuscation and Windows Phone 7 Application Protection

Today most developers registered with the Windows Phone 7 developer program would have received an email entitled Windows Phone 7 App Protection that talks about how to protect the intellectual property within your Windows Phone 7 application. In actual fact it talks very little about this and more about how applications can’t be side loaded (which we all knew anyhow). To draw a quote from the email:

“As a Windows Phone developer you can be assured that Windows Phone Marketplace is operating as designed in providing a level of protection that is in-line with industry practices and sufficient for our own valued content. You can learn about our protection model in the Windows Phone Marketplace Anti-Piracy Model white paper, which outlines our perspective on leak prevention and leak containment. “

To be honest if by “industry practices” you mean that they’re going to publish your application so that it is readily available for anyone interested to download via a web browser, decompress and view using reflector, then we live in a wow-ful industry indeed. In the white paper they acknowledge that Windows Phone 7 applications are not encrypted in any way on the CDN – this makes it a 20 second job to locate, download and open any application posted on marketplace.

They go on about how it’s not possible for someone to re-publish or side-load an application they have downloaded from marketplace. To me the obvious elephant in the room is the fact that anyone can download your application and view your IP.  This is a sad state of affairs and I for one hope that Microsoft have this well and truly on their radars for the first upgrade to Windows Phone 7.

Points to note:

- Don’t assume Microsoft will protect your intellectual property. You’re handing over your application for them to certify, which means your handing over valuable IP for a third party to review. In my mind that’s a BAD, BAD, BAD thing (irrespective of whether it’s available to everyone else).

==> Resolution – Store any valuable IP behind a service. This means that you can protect and/or change it as required

- Don’t include application keys/tokens in your application - Windows Phone 7: Where to store that application key? NOT in the Application(need I repeat this again?)

==> Resolution – Store app keys/tokens behind a service. Whilst not a perfect solution, it does make it slightly harder

- Accessing xaps off marketplace can be done using a proxy (such as fiddler) when you download an app to your phone via zune. I won’t give away too much other than you need to look at the xml file that is retrieved which discloses the direct download url for the xap.

==> Resolution – This information is posted here to put Microsoft on notice: this level of application protection is unacceptable. As a minimum I’d expect some form of encryption of xaps on the wire and something like one time download urls for the xaps. Don’t steal other people’s applications or IP – just because you can, doesn’t make it legal!

Windows Phone 7: Where to store that application key? NOT in the Application

Building Windows Phone 7 applications using Visual Studio 2010 and Expression Blend is so much easier than building for any other mobile platform it’s easy to get lulled into a false sense of security. For example to use the Bing Maps control you need to go and register in order to receive an application key that you use in order to remove the warning message that appears in the middle of the maps control. It’s simple to just add this directly into the application via Blend and walk away – job done. Wrong!

Let’s think about the implications of this. What you’ve done is enter an application key into your application, which is going to be distributed via marketplace to any number of devices. This application key identifies your application and permits you access to Bing Maps (which is free for WP7 applications). Now what happens if one of those devices is owned by a malicious user who has completed at least half a computer science degree. It’s highly possible that they can extract the contents of your application, retrieve the plain text key (that’s right, even if you obfuscate your code, chances are this application key is still going to be visible in plain text) and use it in his own applications. Now your account with Bing Maps is getting completely slammed and Microsoft come knocking on your door asking for money!

So, what did you do wrong? You followed the Microsoft samples blindly. You added a secret application key into an application where ALL the code is easily readable (there are countless threads on how to protect your IP within managed application, and by far one of the safest is to put sensitive code in native code but of course you can’t do that with WP7 applications).

So, what can you do to fix it? Well it’s simple really….. don’t put the application key into the application in the first place. Right, but then how can we use for example the Bing maps control? Ok, so this is the crux of the problem, there is no bulletproof way to do this given the application key model. The best you can do is to place the application key behind a service and then either request it each time the application needs it (no caching) or request it the first time and cache it. Not ideal but at least it adds a layer of indirection to wanna-be-hackers.

Pet Peeve: How to break the back button experience in Windows Phone 7

Over the past couple of weeks I’ve been downloading a number of the new Windows Phone 7 applications and one of the things that has come to annoy me is when developers think that they can outsmart the user. Microsoft has gone to great pains to include a dedicated hardware back button on all Windows Phone 7 devices. It has a very clear function which is to return the user to the previous experience. Within an application this typical means going back to the previous page or closing a modal style dialog/prompt. At the beginning of an application this means allowing the application to close, revealing the previous application (or the Start) the user was in.

Of course, there always have to be the one or two super-smart developers out there that thing that the user might accidentally hit the back button. We don’t want the user to leave our application, in fact the more time we can get them to spend in the application the better, so let’s include a prompt confirming that the user does indeed want to exit the application. WRONG, FAIL, GO BACK, DON’T DO THIS.

As a user if I press the back button I want to go back. If I didn’t mean to leave the application I’ll launch the application again. If the application is any good this shouldn’t be an lengthy process, so even if the user accidentally pressed the back button, they will acknowledge that they made a mistake and so there is no foul. Getting in the way of what the user has explicitly instructed (ie by pressing the back button) the application to do is bad.

There is one exception to this rule: if there is unsaved data, you may want to prompt the user to either save, discard or cancel the operation. To be honest, even this should be avoided – there is no harm in temporarily saving what they were working on and having it available the next time they run the application.

Promoting your Windows Phone 7 application

So you’ve got your Windows Phone 7 application certified and it’s available for download via marketplace. You think you’re done? No, you’ve just started. With more applications appearing in the marketplace all the time it’s important that you continue to promote and advertise your application. To do this Microsoft have come out with a series of buttons that you can use to promote application downloads directly from the website.

Here is a sample of the various sized buttons in blue. There are versions of the button in English, French, German, Italian and Spanish and in blue, red and green. Download for Windows Phone 7 Button


Don’t forget to read the included readme and policy documents that come in the download. Also, for the format of the download link, check out the MSDN Documentation on How to: Link to Windows Phone Marketplace Content